Skip to content

Use absolute URL from production Storybook site for /react-components redirect - #791

Merged
ty2k merged 1 commit into
mainfrom
bugfix/storybook-nginx-configuration
Jul 9, 2026
Merged

Use absolute URL from production Storybook site for /react-components redirect#791
ty2k merged 1 commit into
mainfrom
bugfix/storybook-nginx-configuration

Conversation

@ty2k

@ty2k ty2k commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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 an http:// version of the URL, including the port :8080.

To solve, this PR updates the /react-components location to redirect to the canonical production URL https://designsystem.gov.bc.ca/react-components/. It is slightly sub-optimal to use the production URL because our dev and test environments will also redirect to the production URL when accessed at the /react-components path, 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.

@ty2k
ty2k requested review from Copilot and mkernohanbc July 9, 2026 21:47
@ty2k ty2k self-assigned this Jul 9, 2026
@ty2k
ty2k requested a review from a team as a code owner July 9, 2026 21:47
@ty2k ty2k added react-components Changes or issues affecting the design-system-react-components package bug labels Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-components with 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/;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too clever, would rather have this just use the real URL.

@mkernohanbc mkernohanbc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

@ty2k
ty2k merged commit 42824df into main Jul 9, 2026
6 checks passed
@ty2k
ty2k deleted the bugfix/storybook-nginx-configuration branch July 9, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug react-components Changes or issues affecting the design-system-react-components package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants