0

I'm trying to redirect with 301 some https calls with some proxy forward. The idea is not to go through the proxy, but to return a 301 redirect with the new location. I've got two cases:

https://example.com/dummy/copy/this/path -> https://another.com/other/copy/this/path

So when I call a curl

https_proxy=myforwardproxy:8080 curl https://example.com/dummy/copy/this/path

It should return a redirection 301 to https://another.com/other/copy/this/path with the Host changes and the path reused (avoiding dummy parent path)

I'll try with Nginx, Squid, Varnish, and skipper with the same result. This is the real thing that I want to do: network diagram

Which program will should use? I see that the only can do a redirect proxy forward is Squid, but it uses Redirection Programs (perl scripts or deprecated solutions).

Also I tried NGINX, but need an upstream and I can't configure to avoid crossing the proxy and alwys return 400 Bad Request.

And with varnish I cant get a real Probe of Concept.

albertoiNET
  • 131
  • 5
  • maybe stop looking for the keyword "proxy". This server is not a proxy. It's just a normal server. – user253751 Nov 29 '22 at 18:56
  • Hello @user253751. The word is totally correct. It is a proxy because it is a middle element that intercept calls to outside, and in this case, redirect or forward to another destination. Also is correct use proxy, because I want to use with env vars HTTPS_PROXY and HTTP_PROXY. So, it's a proxy – albertoiNET Nov 30 '22 at 14:13
  • How does curl know *not* to use the proxy the second time? – user253751 Nov 30 '22 at 14:15

1 Answers1

0

Unlike Squid, Varnish is a reverse caching proxy. Its role is to cache content from the origin server and is hosted on the edge. The DNS record for example.com should be pointed to the Varnish server.

If that's not the case and you're just using the proxy locally, you're looking for a forward proxy like Squid.

Thijs Feryn
  • 1,166
  • 4
  • 5