oauth2-proxy: cookies are not correctly set for hostnames with ports
Related to https://github.com/oauth2-proxy/oauth2-proxy/issues/2055
Currently, the following code will print the warning Warning: request host %q did not match any of the specific cookie domains of %q and default to the shortest domain when the hostname of a request and cookie are not matched:
However, this is NOT the correct behavior (and may result in setting the cookie on the incorrect domain), because as discussed in this stack overflow thread, browsers do not distinguish the ports of cookies.
Therefore, we should be stripping off any :XXXX port suffix from the request host when checking which cookie_domain to match it to.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 19 (8 by maintainers)
This is a 1.5 year issue that had a PR that was closed…
This will also prevent to make multiple cookie domains work since it won’t match any… That’s sad.
The comment on the PR:
I don’t understand what you are implying here @JoelSpeed…
Cookies are per domain and does not include ports…
Besides that, the change only applies to the
GetCookieDomainfunction which tries to match the fqdn on the request with a domain specified on the cookies… Cookies will later be (correctly) set to the domain and not using port at all…This issue is not yet resolved (this is why I don’t like stale bots, because they make it harder to identify valid issues which just havent been solved yet).