-
-
Notifications
You must be signed in to change notification settings - Fork 67
fix: use request.protocol to check for HTTPS #282
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
Conversation
gurgunday
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a problem with trusting the header here? We'd at worst be sending secure=true, and if that's not really the case, the browser would ignore it
But I agree with you in principle that proxies should not be trusted when trustProxy is disabled
@fastify/plugins is this breaking?
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
I don't think so. |
|
I don't think always sent Even if the next hop is not a trust proxy, sending |
|
That was what I thought... but the reason I approved anyway is trustProxy wasn't respected at the end of the day... I could accept the following: if (opts.secure === 'auto') {
if (reply.request.protocol === 'https' || (fastify.trustProxy === true && request.headers['x-forwarded-proto'] === 'https')) {
opts.secure = true
} else {
opts.sameSite = 'lax'
}
}However, should be noted that |
This is the same as |
The header shouldn't be read unless
trustProxyis true.Checklist
npm run testandnpm run benchmarkand the Code of conduct