0

I am using Apache for the first time and came across a below requirement.

I am having a requirement to implement a ReverseProxy in Apache based on the HTTP:Accept-Language, my application is hosting enu and french language.

As the URL doesn't have the enu/fra string in it and it can be determined based on the HTTP locale information sent by the authentication system.

Please let us know how we can use the conditional ReverseProxy, as the user will not see any change in the URL he is accessing only the application content will vary based on the language.

I have performed the reverse proxy without language filter successfully however would like to know how can we do it using language.

<IfModule mod_proxy.c>
  SSLProxyEngine on
  ProxyPreserveHost On
  ProxyRequests off
  SSLProxyVerify none
  SSLProxyCheckPeerCN off
  SSLProxyCheckPeerName off
  ProxyPass / https://mydomain:9011/ timeout=1800 Keepalive=On
  ProxyPassReverse / https://mydomain:9011/
 </IfModule>

Thanks for your input in advance.

HBruijn
  • 80,330
  • 24
  • 138
  • 209
Amit
  • 1
  • Apache's mod_rewrite can be used with a P (for proxy) target to create rewrite rules that provide a similar reverse proxy functionality that the more static ProxyPass directives provide. That should allow you to make a conditional reverse proxy https://httpd.apache.org/docs/2.4/rewrite/proxy.html – HBruijn Mar 26 '19 at 10:40
  • Thanks for the reply. Users will below URL: https://sdncogoeri123/oracle/app/ebs/

    My webserver is listening to 443 with hostname : sdncogoeri123 If the application language is selected as English/French then we are looking to redirect the same by routing the request to mydomain:9011 (webserver:port):

    End user should see the URL as https://sdncogoeri123/oracle/app/ebs/enu if language was English End user should see the URL as https://sdncogoeri123/oracle/app/ebs/fra if language was French

    – Amit Mar 26 '19 at 21:34
  • I am getting message "The webpage cannot be found". Please advise what I am doing wrong here.

    RewriteEngine On RewriteCond %{Accept-Language} ^fr [NC] RewriteRule ^/oracle$ https://mydomain:9011/oracle/app/ebs/fra [P] ProxyPassReverse "/oracle/app/ebs/" "https://mydomain:9011/oracle/app/ebs/fra"

    RewriteCond %{Accept-Language} ^en [NC] RewriteRule ^/oracle$ https://mydomain:9011/oracle/app/ebs/enu [P] ProxyPassReverse "/oracle/app/ebs/" "https://mydomain:9011/oracle/app/ebs/enu"

    – Amit Mar 26 '19 at 21:34
  • Please edit and update your question as that allows proper formatting, rather than (only) posting updates as comments. Check also the logs on both the apache webserver and the target server to see if and how your rewrite rules result in incorrect URL's – HBruijn Mar 27 '19 at 07:19

0 Answers0