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

gatsby-adapter-netlify not generating headers for redirects #38538

Open
2 tasks done
techfg opened this issue Sep 9, 2023 · 1 comment
Open
2 tasks done

gatsby-adapter-netlify not generating headers for redirects #38538

techfg opened this issue Sep 9, 2023 · 1 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

Comments

@techfg
Copy link

techfg commented Sep 9, 2023

Preliminary Checks

Description

The gatsby-adapter-netlify is not generating HTTP headers defined in gatsby-config if the route is a redirect route.

Redirect routes support headers as defined in IRedirectRoute.

Based on this comment this appears to be functionality that is not yet implemented but with no "stock" way to "opt-out" of the netlify adapter when building and running on Netlify, this should likely be addressed sooner than later.

Reproduction Link

https://codesandbox.io/p/sandbox/gatsby-adapter-netlify-redirect-headers-missing-82qlk9?file=%2Fpublic%2F_headers

Steps to Reproduce

  1. Go to repro on codesandbox
  2. View the public folder and open _headers file
  3. There is no header for the path /testpage, however other headers from gatsby-config are present

To re-create the scenario:

  1. Run clean task
  2. Run build task
  3. View _headers file in public folder

Expected Result

A X-PageName header should be defined in _headers for the route /testpage

/testpage/
  X-PageName: TestPage

Actual Result

The X-PageName header for /testpage is not in the _headers file.

Environment

System:
    OS: Linux 6.1 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (2) x64 AMD EPYC
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 18.17.1 - ~/.local/state/fnm_multishells/2521_1694238260312/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.7 - ~/.local/state/fnm_multishells/2521_1694238260312/bin/npm
  npmPackages:
    gatsby: ^5.8.1 => 5.12.4
    gatsby-adapter-netlify: ^1.0.0 => 1.0.0

Config Flags

N/A

@techfg techfg added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 9, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 9, 2023
@techfg
Copy link
Author

techfg commented Sep 12, 2023

Will defer to Gatsby team, but this can likely be closed in favor of #38542.

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