fix(router): Handle comma delimited X-Forwarded-For values#168
Conversation
|
|
||
| set_real_ip_from {{ $routerConfig.ProxyRealIPCIDR }}; | ||
| {{ range $realIPCIDR := $routerConfig.ProxyRealIPCIDRs }}set_real_ip_from {{ $realIPCIDR }};{{ end }} | ||
| real_ip_recursive on; |
There was a problem hiding this comment.
are you at all concerned with newlines in the config file here?
There was a problem hiding this comment.
Ah... I am. (Not that I need to be.) What I was trying to do was avoid an unnecessary newline either before or after all the set_real_ip_from, but the consequence of that might have been that I don't get newlines between them either. I know you said this is non-blocking, but I do want to give this a look before I consider merging it.
There was a problem hiding this comment.
Looks like some nicer formatting options made their way into templates last fall and I hadn't noticed since then:
There was a problem hiding this comment.
yep, leading and trailing - chars would help here. official docs are under Text and Spaces at https://godoc.org/text/template
|
@krancour code LGTM. #168 (comment) is not blocking, just wanted to point it out. Added |
|
@krancour do you have an HTTP load balancer setup handy for testing this? How did you set yourself up on GKE? |
|
my comment triggered jenkins. Sorry about that! |
@bacongobbler: No worries. It happens. fwiw, I actually opened an issue against the Jenkins Github Pull Request Builder plugin with relevant logs. I've heard nothing back so far. Re: Testing this in GKE, it's quite a pain to set up. I'll set it up and point you in its direction. |
|
@bacongobbler... an easier way for you to test this might be as follows:
|
|
LGTM: |
|
@bacongobbler thanks for taking the time. fwiw, no need to delete the router pod to apply configs in the future. Router is always watching its own annotations and applying new config when it spots diffs. |
|
I figured that the pod annotations are separate from the rc annotations so I just wanted to make sure. Thanks for the tip! |
Fixes #167 (at least partially; we cannot necessarily fix idiosyncrasies of GCP)
To test this, you'd be best off using GKE. The TCP load balancer that k8s provisions for you when you install workflow would need to be replaced with an HTTP load balancer.
At that point, the router will receive inbound requests with multi-valued
X-Forwarded-Forheaders.Router should have it's
router.deis.io/nginx.proxyRealIpCidrconfigures as follows:Requests to any all applications should yield access log messages form the router that contain your public IP.
See #167 for more information.