Skip to content

Pass X-Forwarded-Host, X-Forwarded-Path headers to backend APIs #260

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

Closed
GUI opened this issue Jul 20, 2015 · 1 comment
Closed

Pass X-Forwarded-Host, X-Forwarded-Path headers to backend APIs #260

GUI opened this issue Jul 20, 2015 · 1 comment

Comments

@GUI
Copy link
Contributor

GUI commented Jul 20, 2015

This is something I thought we were already doing, but it turns out we're not. We should pass the X-Forwarded-Host header to API backend servers so they can more easily determine the original URL used to access their API.

We already pass back X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Port, but this hostname information would be handy since we often rewrite the host in the process of proxying.

We may also consider passing back something like X-Forwarded-Path to inform the backend of the original URL path, in case it was rewritten during proxying. This header doesn't seem as widely used as the others, but for our use-case where rewriting the URL path prefix is common this might make sense. For this header, I think it should just include the path portion of the URL and not any query strings.

For the path information, there are some alternative headers in slightly wider use like X-Original-Url which includes the fully original URL (including the query string), but since we want to strip the API keys from the query string, we don't really ever want to pass back the original URL in it's true form. But I think with the forwarded host, path, port, and protocol this would give everything an API backend would need to figure out what the public URL was.

@mgwalker
Copy link

mgwalker commented Dec 7, 2021

Closing as stale, on the assumption that the need will resurface if it still exists.

@mgwalker mgwalker closed this as completed Dec 7, 2021
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