Use absolute URL from production Storybook site for /react-components redirect - #791
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the React component library’s Storybook Nginx config to make the /react-components → /react-components/ redirect work reliably in production.
Changes:
- Replaces the relative redirect for
/react-componentswith an absolute redirect URL.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+43
to
+47
| # This uses the canonical production URL for the React Storybook | ||
| # deployment because Nginx won't have enough context to cleanly generate | ||
| # a redirect back to /react-components/ otherwise. It will instead attempt | ||
| # an `http://` address with the port `:8080` appended to the domain. | ||
| return 301 https://designsystem.gov.bc.ca/react-components/; |
Contributor
Author
There was a problem hiding this comment.
Too clever, would rather have this just use the real URL.
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.
This PR adjusts the React component library's Storybook Nginx configuration file to fix a redirect bug.
When a user requests
/react-components, we have a redirect that attempts to direct them to/react-components/with a trailing/. Storybook requires the trailing slash to work properly. In practice, this redirect doesn't work in production because Nginx tries to build anhttp://version of the URL, including the port:8080.To solve, this PR updates the
/react-componentslocation to redirect to the canonical production URLhttps://designsystem.gov.bc.ca/react-components/. It is slightly sub-optimal to use the production URL because ourdevandtestenvironments will also redirect to the production URL when accessed at the/react-componentspath, but I think it's worth the trade to have the redirect working in production as expected.If we find this doesn't work or it breaks something else, we can revert.