[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Host header in Nginx proxy 400 Bad request



Hi David,

Are your pods in the same project, or different projects?  If the same project, you can communicate directly with the destination pod using its service address (*.cluster.local) rather than its external hostname.

Can you provide some more detail regarding your application architecture? What are your routes, and what are your services?

On Fri, Oct 21, 2016 at 5:46 AM, David Strejc <david strejc gmail com> wrote:
I got Nginx in Pod in one project and I am setting Host header inside
proxy which points to other Pod in Open Shift.

When I set this header I got 400 bad request response from Nginx.

Does HAProxy inside OpenShift HAProxy router reset Host header?

The purpose of HAProxy is to share an IP address with multiple backing services, similar to the way Virtual Hosting works.  When you connect to HAProxy, it inspects the Host header or uses TLS-SNI to detect the "host" you're looking for (otherwise there's no way to differentiate requests, since the IP address for all the applications behind the router are the same).  This is just done so that the router knows where to send traffic.

I don't think we modify the Host header at all, it's read-only as far as HAProxy is concerned, so whatever you pass in from your browser should be passed through to the nginx instance untouched.  If you're using an HTTPS route with the "passthrough" option, then by definition the HAProxy is unable to read your traffic and hence is unable to modify it.

Can you share logs from your nginx application?

Jonathan

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]