Can you use Haproxy to override a beautiful URL?

HAProxy can rewrite the URI from “domain.com/cool/url” to “domain.com/index.php/cool/url” because it passes the request to the web server NS?

Thank you.

reqrep  < string>
reqirep (ignore case)
Replace a regular expression with a string in an HTTP request line
May be used in sections: defaults | frontend | listen | backend
no | yes | yes | yes
Arguments :
is the regular expression applied to HTTP headers and to the
request line. This is an extended regular expression. Parenthesis
grouping is supported and no preliminary backslash is required.
Any space or known delimiter must be escaped using a backslash
('\'). The pattern applies to a full line at a time. The "reqrep"
keyword strictly matches case while "reqirep" ignores case.

is the complete line to be added. Any space or known delimiter
must be escaped using a backslash ('\'). References to matched
pattern groups are possible using the common \N form, with N
being a single digit between 0 and 9. Please refer to section< br /> 6 about HTTP header manipulation for more information.

HAProxy 1.3 Documentation

Edit: (obviously) it is up to you to decide whether to use HAProxy for rewriting, but I strongly recommend You consider using mod_rewrite (or similar).

HAProxy’s rewrite feature is designed to facilitate load balancing activities, and from a maintenance point of view, web server behavior should not be coupled to the load balancer configuration-i.e., If you want to remove the load balancer from the hosting configuration, a single web server should respond to requests for a given URI with the same content (instead of a 404 error).

HAProxy Can the URI be rewritten from “domain.com/cool/url” to “domain.com/index.php/cool/url” because it passes the request to the web server?

Thank you.

reqrep  
reqirep (ignore case)
Replace a regular expression with a string in an HTTP request line
May be used in sections: defaults | frontend | listen | backend
no | yes | yes | yes< br /> Arguments :
is the regular expression applied to HTTP headers and to the
request line. This is an extended regular expression. Parenthesis
grouping is supported and no preliminary backslash is required.
Any space or known delimiter must be escaped using a backslash
('\'). The pattern applies to a full line at a time. The "reqrep"
keyword strictly matches case while "reqirep" ignores case.

is the complete line to be added. Any space or known delimiter
must be escaped using a backslash ('\'). Reference s to matched
pattern groups are possible using the common \N form, with N
being a single digit between 0 and 9. Please refer to section
6 about HTTP header manipulation for more information.

HAProxy 1.3 Documentation

Edit: (obviously) you decide whether to use HAProxy for rewriting, but I strongly recommend that you consider mod_rewrite (or similar).

HAProxy’s rewrite feature is designed to facilitate load balancing activities, and from a maintenance point of view, web server behavior should not be coupled to the load balancer configuration-i.e., if the load balancer is to be removed from the managed configuration, then A single web server should respond to requests for a given URI with the same content (instead of a 404 error).

Leave a Comment

Your email address will not be published.