Possible to hide external server with reverse proxy?

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

Docker image from Docker

a. System environment:

Docker

b. Command:

Paste command here.

c. Service/unit/compose file:

version: "3.9"
services:
  caddy:
    image: caddy:2-alpine
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped
    volumes:
      - ./caddy/Caddyfile:/etc/caddy/Caddyfile
      - ./caddy/data:/data
      - ./caddy/config:/config

d. My complete Caddy config:

https://dashboard.myco.com {
  reverse_proxy https://dev.theirco.com {
    header_up Host {upstream_hostport}
  }
}

3. The problem I’m having:

I’m not sure it’s possible, but I’m paying for services from another company and would like to make it appear to be coming from my site to avoid customer confusion. Using the above Caddyfile, I can successfully direct traffic to the external site, but it triggers a 307 redirect error and changes the browser URL to their domain.

The behavior I’m hoping for is the customer browser always showing https://dashboard.myco.com/… but serving pages/data from https://dashboard.theirco.com/

4. Error messages and/or full log output:

Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

My best result is the above Caddyfile.

6. Links to relevant resources:

You could try to do a header replacement on the Location header which drives redirects:

	reverse_proxy https://dev.theirco.com {
		header_up Host {upstream_hostport}
		header_down Location dev.theirco.com dashboard.myco.com
	}

But there’s no guarantee that this will work.

Please make requests with curl -v and show what that looks like. Turn on the debug global option and show your Caddy logs.

Without actually seeing what the traffic looks like, we can only make assumptions, and that wastes time for both of us. Please fully complete the help topic template, it’s important so we can give the best help.