Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What can I use to setup a "broken" http proxy?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3602

PostPosted: Sat Jan 23, 2021 6:23 pm    Post subject: What can I use to setup a "broken" http proxy? Reply with quote

I'm looking for a way to hijack traffic going through a http proxy and direct it to a specific upstream server.

So, the user configures his browser to use a http proxy, types the URL in the address bar, and the proxy forwards everything to the pre-defined server, ignoring Host: header from the request.
It seems to be trivial for HTTP traffic, there is nothing particular about those proxied requests so any reverse proxy should work just fine. However, I also want to support https there, and browsers use CONNECT method on the forward proxy before initiating https handshake with the destination server. Haproxy just passes this request to the backend instead of switching to TCP mode.
So I need something else: something that will look like a forward proxy from the client's perspective, and let me set upstream in the config file instead of resolving to DNS, just like a reverse proxy would behave.

Why?
I need an easy to use and reliable way to direct traffic incoming to a single URI to one server or another.
Browser-defined proxy is an easy enough and pretty reliable way to select a route. Now I just have to make sure those 2 don't converge, when the selected forward proxy asks the DNS what to do next.
Stuff like changing /etc/hosts and browser extensions for injecting http headers are not exactly what I call "user friendly". Like in: you can use them once or twice if you need to, but reconfiguring them daily would be a pain.

I do have a backup plan for that, but it's really messy, and I'd love to get a less hacky solution.


Oh, if someone knew a way to make haproxy do the trick, that would be awesome. Accept the CONNECT request and then forward the rest to the predefined server.
I doubt it's possible, but one can never be sure, so I'll leave it there.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3602

PostPosted: Sat Feb 13, 2021 1:12 pm    Post subject: Reply with quote

Alright, I got it sorted. A forward proxy behind a reverse proxy seems to be working fine.
The reverse proxy replaces destination in the requests going to the forward proxy.

Text-based protocols have their advantages :)
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1975
Location: Germany

PostPosted: Sat Feb 13, 2021 5:12 pm    Post subject: Reply with quote

reminds me of http://www.ex-parrot.com/pete/upside-down-ternet.html
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum