-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Node adapter ignores server.headers
under astro preview
#10161
Comments
#5564 Add headers to Vite preview server, but in SSR mode Node integration uses the server defined in createServer as far as I understood. Could we also pass the headers to this server? I can work on this if my understanding is correct. |
Yeah I think it also has to accept astro/packages/astro/src/@types/astro.ts Lines 2743 to 2751 in 9b78c99
So that we can get the headers from:
|
Alright I'll be working on that, if you don't mind. |
In order to add headers to the response, I added a 'request' listener to the preview server and modified the response inside. It worked but now the headers are added even at 404 responses. I added a response status code check to avoid it but 404 responses still goes through. This listener is added after server is created so my listener should be called last and catch the 404 reponses but it is not. What I'm missing here? |
I couldn't solve the 404 problem, if user added custom headers at astro/packages/astro/src/core/app/index.ts Lines 450 to 458 in 7fe2515
|
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When running
astro dev
, the headers set byastro.config.ts
are received in responses. However, they are not received when runningastro preview
.The headers I'm trying to use are:
What's the expected result?
Receive configured headers when running
astro preview
.Link to Minimal Reproducible Example
https://github.com/nvzqz/astro-missing-headers
Participation
The text was updated successfully, but these errors were encountered: