Proxy not changing port to refer to

Hello All,

I am trying to set up a webserver using Caddy, however, some applications are running on different ports (same server), therefore I use the proxy functionality as well, however unsuccessful. Googling, SO’ing and going over this forum has not given me the solution so far.

I have tried various configurations, let me go over a few of them from simple to “more” extended.

Goal: Run website on 443, oauth is running on 9090 with an endpoint oauth/token.
Expectation: When I hit a button that has a link http://[ip]:443/oauth/token I expect it to go over port 9090.
Actual happening: When I click the button with linkt http://[ip]:443/oauth/token it remains this link.


    :443 { # Also tried with https://[ip]
       proxy /oauth localhost:9090 {

Does it have todo with the fact that I do not have a domain name? I have also tried without the transparent and a view other things that were more trail and error.

I am running Ubuntu 18.04.1 LTS (Bionic Beaver)

Thanks for any suggestion

G’day @crittje, welcome to the Caddy community.

A proxy will disguise the fact that it’s contacting the upstream server localhost:9090. It will serve you the content from that location from port 443. The “link” (the URL), as viewed by the client (probably your web browser), will not change.

Hi Whitestrake,

Thanks for getting me off the confusion, it took me to the direction of the issue. Indeed the auth server was being reached, but client shows 443 still. I was not aware of that, even though having used caddy before.

I actually had to configure my spring app accordingly:

  use-forward-headers: true
    remote-ip-header: X-Forwarded-For
    protocol-header: X-Forwarded-Proto
    internal-proxies: 192\.168\.\d{1,3}\.\d{1,3}
    protocol-header-https-value: https

Thanks thanks thanks!

1 Like

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