gatsby-adapter-netlify
not respecting "force"
option passed to createRedirect
#38541
Open
2 tasks done
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
Preliminary Checks
Description
The
gatsby-adapter-netlify
is not applying theforce
attribute as expected, according to the docs on Netlify and for Gatsby'screateRedirects
API. I also see that there is code which is meant to apply this attribute:gatsby/packages/gatsby-adapter-netlify/src/route-handler.ts
Lines 90 to 92 in db248ab
Without the
force
attribute, we cannot complete some of our desired redirects. We also cannot re-write the default200
status code for our/404
page to be an actual404
status code, which we believe is more appropriateThe "Reproduction Link" below can be used to examine the resulting
_redirects
file, however in our Netlify site we are seeing the behavior we would expect from such a fileReproduction Link
https://codesandbox.io/p/sandbox/gatsby-adapter-netlify-redirect-headers-missing-82qlk9?file=/public/_redirects:6,1
Steps to Reproduce
codesandbox.io
site providedcreateRedirect
call defined ingatsby-node.js
, which has the optionforce: true
setpublic/_redirects
Expected Result
With the
force: true
option set, the redirect should look like:/testpage /test-page 301!
, as theforce: true
option should apply an!
to the status code and let Netlify know that the redirect should occur even if thefromPath
defined already existsActual Result
the result in
_redirects
does not have the exclamation point, and so is not "forced"Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: