Reverse proxy providing a resource behind another proxy?

Hi,

I have a question. I have a http proxy server (not caddy) which I use to connect to an api on port 12345. (eg https://example.org:12345/api/v2/blah)
Is it possible to use caddy to connect to that server behind the proxy?

right now I am configuring the proxy server inside my browser so I can access that resource. But what I want: I want to call http://localhost:11111 which opens the api directly.

http://localhost:11111 → caddy (reverse proxy?) connects to https://example.org:12345 via proxy which is specified inside caddy (not a global proxy) the proxy is not secured.

Is something like this possible using caddy?

1. Caddy version (caddy version):

v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=

2. How I run Caddy:

I run the command “caddy” inside wsl2. Inside the folder where I execute is still an empty Caddyfile, thats where I need some help.

a. System environment:

windows 10 / wsl2 (ubuntu 20.04)

b. Command:

caddy

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:

empty! this is just a generat question.

3. The problem I’m having:

no Idea if this is possible. No problems yet.

4. Error messages and/or full log output:

5. What I already tried:

google, documentation. Not really sure what I am supposted to search for.

6. Links to relevant resources:

Can caddy reach that host directly?

unfortunately not. There is some protection on that host with whitelisted IP. The only whitelisted ip is the ip of that proxy server. So when I connect from my localhost using that proxy server, I can request the resource from that server.

So you’re asking whether Caddy has a module that implements a Proxy CONNECT, perhaps like this one?

https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

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