Может ли HAProxy переписать URI с «domain.com/cool/url» на «domain.com/index.php/cool/url» при передаче запроса на веб-сервер?
Спасибо.
reqrep <search> <string>
reqirep <search> <string> (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 :
<search> 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.
<string> 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
6 about HTTP header manipulation for more information.
Редактировать: (Очевидно) вам решать, решите ли вы реализовать перезапись с помощью HAProxy, однако я настоятельно рекомендую вам рассмотреть возможность использования mod_rewrite (или аналогичный).
Функциональность перезаписи HAProxy предназначена для облегчения действий по балансировке нагрузки, и, с точки зрения обслуживания, поведение веб-сервера не должно быть связано с конфигурацией балансировщика нагрузки, то есть если балансировщик нагрузки должен быть удален из конфигурации вашего хостинга, один веб-сервер должен отвечать тем же содержимым (а не ошибками 404) на запрос по заданному URI.