Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Proxypass rewrite Host header #658

Open
alsyia opened this issue Nov 26, 2019 · 0 comments
Open

Proxypass rewrite Host header #658

alsyia opened this issue Nov 26, 2019 · 0 comments

Comments

@alsyia
Copy link

alsyia commented Nov 26, 2019

Hi,

We have an application that need to be accessible from two DNS and for which requests' URLs should be rewritten.

We configured marathon-lb as follow:
HAPROXY_0_VHOST=dns1.com,dns2.com
HAPROXY_0_PATH=/api
HAPROXY_0_HTTP_BACKEND_PROXYPASS_PATH=/api

We see requests arriving to the application with a Host header equal to dns1.com,dns2.com (which breaks some stuff in our own code). Skimming through the code, I think the issue lies in the default HTTP_BACKEND_PROXYPASS template which is:

http-request set-header Host {hostname}
reqirep  "^([^ :]*)\ {proxypath}(.*)" "\\1\ /\\2"

This takes the app hostname (the content of HAPROXY_0_VHOST) and put it directly in the Host header, regardless of the original value.

I can override this default template, but I wonder why it has been written this way. What is the point of rewriting the Host header to the value it should already have? Am I missing something?

Please note it works well when HAPROXY_0_VHOST contains a single entry.

Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant