this post was submitted on 22 Jun 2024
11 points (100.0% liked)

Programming

17350 readers
338 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

I have a server (S-1) with HAProxy and a number of residential proxies (PR-s) as login-passwords-port. There're multiple users who will connect to the internet via S-1.

I want to have HAProxy to forward incomming traffic of the users via a random proxy amoung PR-s with 2 conditions:

  1. only when there's certain, pre-defined keyword in the URL, traffic must be routed via a proxy.
  2. In all other cases, it must go to a requested resource directly as is, without a proxy

How would I implement this?


(1) client -> HaProxy -> if keyword --> sub-proxy (random) -> website

(2) client -> HaProxy -> if no keyword --> website

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (5 children)

Maybe have two cases:
For the (matched keyword) case, something like this: https://serverfault.com/questions/729232/reg-exp-for-url-in-haproxy

For the (random routing) case, something like: https://www.haproxy.com/blog/haproxy-configuration-basics-load-balance-your-servers

I am a little confused on your question, though. It sounds like you maybe want 3 cases? Can you try wording it differently?

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (4 children)
  1. client -> HaProxy -> if keyword --> sub-proxy (random) -> website
  2. client -> HaProxy -> if no keyword --> website
[–] [email protected] 2 points 4 months ago (3 children)

Cool, I think that first link will work for you. Then you can just 'redirect' for the no-keyword case: https://www.haproxy.com/documentation/haproxy-configuration-tutorials/http-redirects/

Remember, SSL/HTTPS does encrypt the URL path, so if the final website requires HTTPS, your proxy will need to have its certificate trusted by your clients

[–] [email protected] 1 points 4 months ago
load more comments (2 replies)
load more comments (2 replies)
load more comments (2 replies)