-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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(core): response phase skips header.before #10056
Conversation
As discussed offline, I feel the right fix would be to change this: to header[upstream_status_header] = ctx.buffered_status or tonumber(sub(var.upstream_status or "", -3)) |
Does this work the same way: local upstream_status = ctx.buffered_status or var.upstream_status
header[upstream_status_header] = tostring(tonumber(sub(upstream_status or "", -3))) |
53424cd
to
438945c
Compare
I think not. There is only possible multiple status codes on var, as it collects all status codes (from possible retries with balancer), but i think just one code in ctx that is read from location capture res.status. |
b235261
to
90548e4
Compare
I've updated the fix according to your comment. |
6d939ef
to
5d2d4da
Compare
kong/runloop/handler.lua
Outdated
local upstream_status = ctx.buffered_status or tonumber(sub(var.upstream_status or "", -3)) | ||
header[upstream_status_header] = tostring(upstream_status) |
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.
I see you added tostring
here. Not sure why. Perhaps then the tonumber
above is unwanted. That is now it can set header to "nil"
. Not sure can it happen but still. Perhaps just remove the tostring
?
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.
Removing. I was trying to eliminate a warning.
359e260
to
2376517
Compare
This causes some of the header handlings to be skipped.
Full changelog:
runloop.lua
: moving the header phase before and after handlers and changing the way to get status in before handlerinit.lua
: adjust the ordering of handlers and set status (send headers).Fix #10031