porthaproxy

HAProxy how to set a port to get requests and send them to another server using ip of haproxy but not the client ip


Can I get haproxy to redirect requests(GET PUT POST) to a particular server and send back response using ip of haproxy?

I have a client that is allowing requests only from dedicated list of ip's, and need to be able to send requests not only from haproxy server(which ip is allowed) but from other workstations/applications

something like this work seems not working, my knowledge is poor in haproxy

frontend octo_front
   bind *:3090
   default_backend octo_back

backend octo_back
   server octouz https://needed.url%[capture.req.uri] check

Solution

  • Some more reading the documentation helped this is the configuration that worked for me

    frontend sandbox_octo_front
        bind *:3099
        option forwardfor
        default_backend octo_back
    
    backend sandbox_octo_back
        mode http 
        option forwardfor
        http-request replace-header Host .* needed.url 
        server octouz needed.url:443 ssl verify none