Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:37:45+00:00 2026-06-17T18:37:45+00:00

I have an haproxy 1.4 installed and I need to configure a reverse proxy

  • 0

I have an haproxy 1.4 installed and I need to configure a reverse proxy in haproxy.conf that rewrites a URL from www.somedomain.com to www.otherdomain.com/bla/ble. the configuration that I am writing is here:

acl                     cpol_acl hdr_dom(host) -i www.somedomain.com
use_backend             cpol_srv if cpol_acl


backend cpol_srv
    balance                 leastconn
    mode                    http
    option                  httplog
    stick                   on src
    stick-table             type ip size 10240k expire 60m
    reqirep                 ^([^\ :]*)\ /(.*)       \1\ /bla/ble\2
    reqirep                 ^Host:\ www.somedomain.com Host:\ www.otherdomain.com
    server                  cpol_srv www.otherdomain.com check port 80

This is working but the URL in the browser does rewrite to www.otherdomain.com/bla/ble and that’s not what I want. If I remove the line

reqirep                 ^([^\ :]*)\ /(.*)       \1\ /bla/ble\2

I only can forward to the host www.otherdomain.com but the URL in the browser stays with www.somedomain.com.

Is there any way of doing this types of reverse proxy without rewriting the browser URL?

PS: I would do this Apache style (which works) but the machine does not have any NAT to the world outside, and can only communicate to haproxy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:37:47+00:00Added an answer on June 17, 2026 at 6:37 pm

    Well, after a while I figured out what has to be done.

    It’s not sufficient to change only the request but also have to change the response back to the original requesting host. It was also made an acl to prevent repetition of the directory url part “/bla/ble”. Sticking to the example above this should be done like so:

        acl                     cpol_acl hdr_dom(host) -i www.somedomain.com
        use_backend             cpol_srv if cpol_acl
    
    
    backend cpol_srv
        balance                 leastconn
        mode                    http
        option                  httplog
        stick                   on src
        stick-table             type ip size 10240k expire 60m
        **acl                     no_redir url_beg   /bla/ble/**
    
        reqirep                 ^Host:\ www.somedomain.com Host:\ www.otherdomain.com
        reqirep                 ^([^\ :]*)\ /(.*)       \1\ /bla/ble\2   **if !no_redir**
    
    
        **rspirep                 ^([^\ :]*)\ (.*)www.otherdomain.com/bla/ble/(.*)    \1\ \2www.somedomain.com/\3**
    
        server                  cpol_srv www.otherdomain.com check port 80
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a shell script to soft-restart HAProxy (reverse proxy). Executing the script from
I have setup the new version of haproxy but I need to disable TLS
I'm using HAProxy 1.4.22. I have the following haproxy.conf file: global maxconn 100000 daemon
I have a server running HAProxy, and would like to change iptables on that
I need to have sticky sessions on my haproxy(1.4). Below my backend configuration. cookie
I have a Sentry application, running correctly on the url: mydomain.com:11011. I have a
I have a drupal site that runs on nginx and php-fpm with haproxy balancing
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
have a nice day. I got problem when trying to create an image from
I trying to use the new haproxy with ssl(1.5-dev12). But I have an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.