How to proxy and remove path, but add port

Only recently started using caddy. Most of my proxy directives work, but I can’t seem to find out how to proxy https://my.domain/abc to https://my.domain:12345.

Given this portion of my Caddyfile (which probably shows I am a novice)
xxxxxxxx.duckdns.org/s3 {
    proxy / https://xxxxxxxx.duckdns.org:12345 {
        without s3
        without /s3
        without /s3/
    }
}

https://xxxxxxxx.duckdns.org/s3 results in "502 Bad Gateway" even though
https://xxxxxxxx.duckdns.org:12345 works properly.

Thanks in advance for any help you can give me.

Hi @jaalperin, welcome to the Caddy community!

What’s the result of curl -IL https://xxxxxxxx.duckdns.org:12345 from a shell on the Caddy host? It might help us figure out exactly what Caddy is seeing when it tries to proxy to it.


P.S. You can remove the without s3 and without /s3/ variants - the correct form is the middle one.

Thank you Matthew.

The output of the curl command was:
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: curl - SSL CA Certificates
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it.

I replaced the cert.pem with fullchain.pem, and the 502 problem resolved.

Very much enjoying the ease of use (and learning) of Caddy. Much easier for me than NGINX was.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.