-
-
Notifications
You must be signed in to change notification settings - Fork 253
Support of X-Forwarded-Host #128
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
Comments
agree; a tested pull request would be great an easy to apply! |
Thanks a lot @bodewig to take the relay on the implementation: I'm still trying to understand my company policy regarding contributions to open sources... In parallel, I however made some tests and research, and it appears that the Would it be possible that you switch to this second implementation, adding the missing leading and trailing spaces removal (should look like the following: Thanks a lot for your help! |
First of all, we probably want to support In the multi-layer architecture you describe I would have expected a single header per proxy (and we'd need the outermost one). |
Oops, I did not realize the existence of the Regarding the format of the Do you think we can take all of this (X-Forwarded-Host usage + comma-separated list format) as an assumption? |
Yes, of course. It may just take a few days. |
Sure, sure, we'll see this in 2018 !! :P |
I've updated #129 to deal with multiple headers (and use only the first one) and a comma-separated list of hostnames. I simply throw away all whitespace which may even help the X-Forwarded-Proto case. For |
both included in release 1.5.3 now |
Hi all,
In case both lua-resty-openidc (deployed as Relying Party) and the Authorization server are deployed behind a front-end reverse proxy, hostnames of URLs used "externally" (i.e. from the Web Browser to the front-end reverse proxy) are different from the hostnames of URLs used "internally (i.e. from the front-end reverse proxy to the Relying Party and the Authorization server).
As a consequence, when lua-resty-openidc is called, internal hostnames are used, so the way the redirect URI is build (here, using
ngx.var.http_host
) makes theredirect_uri
query parameter of the returned URL contain an "internal" hostname that will unfortunately not be accessible from the external Web Browser.To prevent from this situation, the
X-Forwarded-Host
header is usually used. This header will be set by the front-end reverse proxy.Impact on the code of lua-resty-openidc is quite limited in a first approach. Instead of:
we could have:
In a second approach :P, it looks the
X-Forwarded-Host
header might be multi-valued, each value being separated by a comma","
(for example:X-Forwarded-Host: host1, host2
). A better implementation would be to parse the content ofX-Forwarded-Host
and use the first host of the list…It is maybe required to remove some leading or trailing spaces...
The text was updated successfully, but these errors were encountered: