feat: fix GitHub Pages deployment by correcting asset paths for subdirectory hosting - #60
Merged
Merged
Conversation
|
|
hsluoyz
marked this pull request as ready for review
October 14, 2025 13:44
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix accessibility issue for casdoor authenticator website
Fix GitHub Pages deployment by correcting asset paths for subdirectory hosting
Oct 14, 2025
|
🎉 This PR is included in version 1.25.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The web app deployed at https://casdoor.github.io/casdoor-authenticator was not accessible due to incorrect asset paths. When users visited the site, they encountered a blank page because the browser couldn't load the required JavaScript and favicon assets.
Root Cause
When Expo exports the web app, it generates
index.htmlwith absolute paths:These absolute paths work fine for root domain deployments, but fail when the app is deployed to a GitHub Pages subdirectory. The browser tries to load assets from:
https://casdoor.github.io/favicon.ico→ 404 Not Foundhttps://casdoor.github.io/_expo/...→ 404 Not FoundInstead of the correct paths:
https://casdoor.github.io/casdoor-authenticator/favicon.ico✓https://casdoor.github.io/casdoor-authenticator/_expo/...✓Solution
Added a post-build step in the
deploy-web.ymlworkflow that automatically fixes the paths after the Expo export:GITHUB_REPOSITORYenvironment variable (format:owner/repo)index.htmlusingsedto include the repository prefixThe script transforms the paths from:
To:
Benefits
Testing
Thoroughly tested locally by:
npm run export:webGITHUB_REPOSITORYenvironment variableindex.htmlcontains correct paths with the repository prefixFixes issue where https://casdoor.github.io/casdoor-authenticator was not accessible.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdp.expo.devnode /home/REDACTED/work/casdoor-authenticator/casdoor-authenticator/node_modules/.bin/expo export --platform web --output-dir dist(dns block)node /home/REDACTED/work/casdoor-authenticator/casdoor-authenticator/node_modules/.bin/expo export --platform web --output-dir dist --clear(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #59
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.