Reverse proxy with different URLs

1. Output of caddy version:

$ caddy version
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

sudo caddy run # via a Caddyfile

a. System environment:

$ uname -a
Linux outserv-zero 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

b. Command:

Paste command here.

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

Paste your config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.

3. The problem I’m having:

I want to have two upstreams for my reverse proxy. The issue is, one of them has a path, and the other doesn’t. Like upstream1.com and upstream2.com/path/subpath . Also, one of them is HTTP, and the other is HTTPS.

All the comms are done via POST requests. So, requests don’t have paths. The reason upstream 2 uses a path is as an API key. Is there a way to load balance across these upstreams via Caddy?

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:

6. Links to relevant resources:

I don’t understand… you want Caddy to load balance between two upstreams that don’t accept requests in an identical way?

That doesn’t quite make sense to me.

Load balancing is almost always done to identical or near-identical servers (from an HTTP traffic standpoint).

Please completely fill out the help topic template. We’re missing a lot of key information here, I think.

1 Like

Hey @francislavoie ,

That’s correct. One accepts HTTP, the other HTTPS. The one uses upstream1.com, the other uses upstream2.com/path . Is that possible at all?

No it’s not possible. The transport config is not per-upstream, and neither is rewrite config.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.