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

Accessing original host IP #270

Closed
maracko opened this issue Jun 30, 2021 · 3 comments
Closed

Accessing original host IP #270

maracko opened this issue Jun 30, 2021 · 3 comments
Labels

Comments

@maracko
Copy link

maracko commented Jun 30, 2021

How can I access the original IP address of the remote host that tried to access a domain that is managed by caddy-docker proxy?

@francislavoie
Copy link
Collaborator

Caddy adds the X-Forwarded-For header to requests to the proxy upstream https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#headers

But, if you're running in swarm mode, you may run into this issue: moby/moby#25526. Gist of it is that swarm's TCP ingress will cause the remote IP to be rewritten, so the original client's IP would be lost. There's some workarounds listed in that thread that you may want to try.

@maracko
Copy link
Author

maracko commented Jul 1, 2021

image
On my Go server I have CORS headers set up but the caddy doesn't send X-Forwarded-For header, do I have to turn it on somewhere?

@francislavoie
Copy link
Collaborator

Those are response headers. The X-Forwarded-For header is passed in the upstream request.

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

No branches or pull requests

2 participants