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

Fix response header management in Fastify plugin #517

Merged
merged 5 commits into from
Mar 7, 2023

Conversation

smaye81
Copy link
Member

@smaye81 smaye81 commented Mar 7, 2023

Fastify maintains headers on the reply object and copies to the raw response during reply.send but we are not using reply.send with this plugin. So we need to manually copy them over before handing off to vanilla Node.

This was causing some issues with CORS as it was preventing the Access-Control-Allow-Origin header from being set on the response. fastify/cors sets it on the reply headers, but this was never making it over to the raw response.

@smaye81 smaye81 requested a review from timostamm March 7, 2023 14:35
@smaye81 smaye81 merged commit cb08fe8 into main Mar 7, 2023
@smaye81 smaye81 deleted the sayers/fix_response_headers branch March 7, 2023 15:04
@smaye81 smaye81 mentioned this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants