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

proxy pass assistance #365

Closed
jungle-boogie opened this issue Nov 24, 2015 · 3 comments
Closed

proxy pass assistance #365

jungle-boogie opened this issue Nov 24, 2015 · 3 comments
Labels
question ❔ Help is being requested

Comments

@jungle-boogie
Copy link

Hello,

I have a simple nginx config as follows:

 server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        proxy_pass http://10.132.5.134:8080/;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Can Caddy do something similar with the proxy setup as is?

@mholt mholt added the question ❔ Help is being requested label Nov 24, 2015
@mholt
Copy link
Member

mholt commented Nov 24, 2015

Your equivalent Caddyfile would be:

localhost:80
proxy / http://10.132.5.134:8000 {
    proxy_header X-Real-IP {remote}
    proxy_header Host {host}
}

This can be obtained from the proxy docs.

It's been a while since I've done much with the proxy middleware -- I'm not sure, off-hand, if the Host header needs to be set explicitly, but I do believe X-Forwarded-For is already set for you. (Feel free to double-check if that works for you.)

@jungle-boogie
Copy link
Author

Thanks so much!

Is the code for caddyserver.com on github? If so, can I make a PR with this example?

@mholt
Copy link
Member

mholt commented Nov 24, 2015

It's here: https://github.com/caddyserver/caddyserver.com

You're certainly welcome to submit a PR, but keep in mind there's a couple similar examples already; is this one different enough that it merits its own example? (Just don't want to overwhelm the reader.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❔ Help is being requested
Projects
None yet
Development

No branches or pull requests

2 participants