Skip to content

Conversation

@JBR-0100
Copy link

@JBR-0100 JBR-0100 commented Dec 1, 2025

Description

Fixes an issue where redirects were missed when pathPrefix was present because findPath was using the raw pathname (including prefix) for lookup.

This PR changes findPath to use trimmedPathname (without prefix) for maybeGetBrowserRedirect, ensuring that redirects defined in redirects.json (which are prefix-agnostic) are correctly matched.

Related Issue

Fixes #32142

Verification

A reproduction test case has been added in packages/gatsby/cache-dir/__tests__/repro_issue.test.js. This test simulates a scenario where a request is made to a path that should redirect, but includes a pathPrefix.

Note: Local verification was limited due to environment setup issues, but the fix is based on clear code analysis of how pathPrefix was being mishandled in the redirect lookup.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page 404 not rendering react when using pathPrefix and redirect

1 participant