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

Pass headers to custom error backend #275

Merged
merged 1 commit into from
Feb 14, 2017
Merged

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Feb 14, 2017

fixes #273

@aledbf aledbf added the nginx label Feb 14, 2017
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 14, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage remained the same at 46.002% when pulling d534d7f on aledbf:pass-headers into 1f70373 on kubernetes:master.

Copy link
Contributor

@bprashanth bprashanth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one nit about variable name

["X-Code"] = status or "404",
["X-Format"] = ngx.var.httpAccept or "html",
}
headers = headers,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable names are a little confusing, can you name one of the "headers" something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Changed.

local random_backend = get_destination()
local res, err = httpc:request_uri(random_backend, {
path = "/",
method = "GET",
headers = {
["X-Code"] = status or "404",
["X-Format"] = ngx.var.httpAccept or "html",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my own education, can you clarify how ngx.var.httpAccept was inadequate in this case?

Copy link
Member Author

@aledbf aledbf Feb 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing. The idea of this PR is to pass all the headers from the original request to the custom error backend and use the original Accept header.

@aledbf aledbf force-pushed the pass-headers branch 2 times, most recently from 78333f8 to 3551525 Compare February 14, 2017 18:35
@bprashanth bprashanth added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2017
@bprashanth
Copy link
Contributor

LGTM pending travis, feel free to merge once that's done

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 45.963% when pulling 3551525e1cf30826c722b31f96a88474d2594cfc on aledbf:pass-headers into 1f70373 on kubernetes:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 46.002% when pulling 3551525e1cf30826c722b31f96a88474d2594cfc on aledbf:pass-headers into 1f70373 on kubernetes:master.

@aledbf
Copy link
Member Author

aledbf commented Feb 14, 2017

@bprashanth ok, I am still testing :)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 46.002% when pulling 4245d2a58618fca7b6ca206ea504d4e50191b216 on aledbf:pass-headers into 1f70373 on kubernetes:master.

@aledbf aledbf changed the title WIP: Pass headers to custom error backend Pass headers to custom error backend Feb 14, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 45.971% when pulling 0cdc4bd on aledbf:pass-headers into a9b5770 on kubernetes:master.

@aledbf aledbf merged commit a8b8967 into kubernetes:master Feb 14, 2017
@aledbf aledbf deleted the pass-headers branch February 16, 2017 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. nginx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass request headers to error backend
5 participants