We are encountering an error when trying to log in to our Gatsby site hosted on Netlify. The error appears in the browser’s console during login attempts, and despite several efforts to resolve it through different approaches, the issue persists.
We tried to modify the netlify.toml file to include custom headers. Unfortunately, this did not resolve the issue.
__headers File:
We created a __headers file at the root level of our project, hoping to override headers at the project level. This approach also failed to resolve the issue.
Gatsby Configuration (gatsby-config.js):
We attempted to override the headers within the gatsby-config.js file by configuring the Netlify plugin and providing a headers object specifically for this purpose. Despite this, the issue persists.
Expected Behavior:
The login process should complete successfully without errors in the console, and any custom headers set should be applied correctly.
Actual Behavior:
An error is thrown in the console during login attempts, and the custom headers do not seem to be applied as expected.
Additional Information:
The issue seems to be related to custom headers and how they are being handled by Netlify in the context of a Gatsby site.
We are using the latest version of Gatsby and the Netlify plugin.
Request:
We need assistance in identifying and resolving the cause of this error. We suspect that the issue may be related to the handling of custom headers on Netlify when using Gatsby. Any insights or recommendations for further steps would be greatly appreciated.
@Umang Checking your supplied screenshot the error is:
Invalid 'X-Frame-Options' header encountered when loading
'https://store.duxiana.com/': 'allow-from https://store.duxiana.com/'
is not a recognized directive. The header will be ignored.
As shown to the right of that message, it is being triggered by the request to:
Sorry for the confusion, but I’m asking if it’s possible to remove the console error that appears whenever a user logs into the site. How can I resolve this issue?
Should I use the CSP (Content Security Policy) header instead of X-Frame-Options, and deploy this change to production? Could you please review my file with the updated changes?
@Umang Sorry but I’m not going to provide project specific consultancy.
I’m just a volunteer though, while Netlify’s own staff operate to their Scope of Support.
They might be more interested in helping you determine specific values, my only interest was in pointing out that the headers system does work and helping you get initially unstuck.