You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[fix] ctx.request.origin ignores proxy flag (X-Forwarded-Proto) #1746
When using the proxy flag set to true, ctx.request.origin ignores it, returning http:// instead of https:// (taken from X-Forwarded-Proto, available in ctx.protocol)
Node.js version: v16.14.0
OS version: Debian 10
Description: With koa's proxy flag to true, ctx.request.origin returns wrong protocol because it doesn't match with the X-Forwarded-Proto header (available in ctx.protocol).
Could not reproduce. Code looked OK. Behavior looked OK. When proxy option is on, any X-Forwarded-Proto value is shown as the protocol and ctx.protocol is consistent with ctx.request.origin.
Could not reproduce. Code looked OK. Behavior looked OK. When proxy option is on, any X-Forwarded-Proto value is shown as the protocol and ctx.protocol is consistent with ctx.request.origin.
Sorry for late reply. I'll re-verify the consistency of ctx.protocol again.
I did it before using a nginx reverse proxy + cloudflare, that may be causing the problem.
Activity
siakc commentedon Dec 22, 2023
Could not reproduce. Code looked OK. Behavior looked OK. When proxy option is on, any X-Forwarded-Proto value is shown as the protocol and ctx.protocol is consistent with ctx.request.origin.
xorweak commentedon Jan 16, 2024
Sorry for late reply. I'll re-verify the consistency of ctx.protocol again.
I did it before using a nginx reverse proxy + cloudflare, that may be causing the problem.
fix: ctx.request.origin should respect proxy flag via X-Forwarded-Proto