Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing slash redirect broken when using path prefix #39043

Open
2 tasks done
patrickdemers6 opened this issue Jul 13, 2024 · 0 comments
Open
2 tasks done

Trailing slash redirect broken when using path prefix #39043

patrickdemers6 opened this issue Jul 13, 2024 · 0 comments
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@patrickdemers6
Copy link

patrickdemers6 commented Jul 13, 2024

Preliminary Checks

Description

A project using pathPrefix and trailingSlash does not redirect properly.

When a page is loaded and requires a redirect due to the slash, the redirect does not take pathPrefix into account.

Reproduction Link

https://github.com/patrickdemers6/gatsby-slash-redirect-path-prefix-bug

Steps to Reproduce

  1. Set pathPrefix to anything.
  2. Set trailingSlash to never.
  3. Run with gatsby build --prefix-paths and gatsby serve --prefix-paths
  4. Load a page with trailing slash.

Example: pathPrefix = /prefix

Expected Result

The redirect removes just the trailing slash.

Expected /prefix/hello/ => /prefix/hello

Actual Result

The redirect removes the slash and the pathPrefix.

Actual /prefix/hello/ => /hello

Environment

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.17.0/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
  Browsers:
    Chrome: 126.0.6478.127
    Safari: 17.5
  npmPackages:
    gatsby: ^5.14.0-next.4 => 5.14.0-next.4
  npmGlobalPackages:
    gatsby-cli: 5.13.3

Config Flags

No response

@patrickdemers6 patrickdemers6 added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 13, 2024
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 13, 2024
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 type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

1 participant