Skip to content
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

Preserve host through reverse proxy #299

Open
jezen opened this issue Jan 16, 2025 · 2 comments
Open

Preserve host through reverse proxy #299

jezen opened this issue Jan 16, 2025 · 2 comments

Comments

@jezen
Copy link
Collaborator

jezen commented Jan 16, 2025

There are cases when it is desirable to preserve the Host header when implementing a reverse proxy.

Here's how this looks with other popular reverse proxies.

# nginx
proxy_set_header Host $http_host;

# Apache2
ProxyPreserveHost On

In the general case [IIUC], it is desirable to strip the Host header, as keter does. But I think this should be configurable, so I would propose an extension to ReverseProxyConfig such that in keter.yml, you could tell keter not to strip that header by writing something like this:

  - type: reverse-proxy
    reversed-host: localhost
    reversed-port: 3000
    reversed-ssl: false
    reversing-host: sub.domain.com
    preserve-host: true
    ssl:
      key: /etc/letsencrypt/live/domain.com/privkey.pem
      certificate: /etc/letsencrypt/live/domain.com/fullchain.pem
@jappeace
Copy link
Collaborator

you could do this by adding a config field there:

<$> o .: "reversed-host"

and then just pass it to the filter header function (instead of always false whatever the config setting is).
by default (or omission) it needs to be set to false.

@jezen
Copy link
Collaborator Author

jezen commented Jan 16, 2025

Yeah, that's pretty much exactly how I'd approach this, and I intend to work on this myself. Just documenting here for the sake of posterity 🙂

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

No branches or pull requests

2 participants