Apache Web Server Rewrite rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Experts,


Really need your help to resolve an issue. In our case, F5 Load balancer is forwarding http requests to Apache Web Server at 9080. We have an existing rewrite rule as below. 


NameVirtualHost *:9043
<VirtualHost *:9043>
        SSLEngine on


        SSLCertificateFile /local/isign/apachewebserver/httpd242/conf/isigndev-2048.crt
        SSLCertificateKeyFile /local/isign/apachewebserver/httpd242/conf/isigndev.key


        ProxyRequests Off
        ProxyPreserveHost On
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyPass               /iSign ajp://127.0.0.1:8009/iSign
        ProxyPassReverse        /iSign ajp://127.0.0.1:8009/iSign
        ProxyPass               /MSBPlugIn ajp://127.0.0.1:8009/MSBPlugIn
        ProxyPassReverse        /MSBPlugIn ajp://127.0.0.1:8009/MSBPlugIn
ProxyPass / ajp://127.0.0.1:8009/iSign/index.html
ProxyPassReverse / ajp://127.0.0.1:8009/iSign/index.html
        ServerName isign-dev.gsk.com 
</VirtualHost>


<VirtualHost *:9080>
RewriteEngine On
RewriteCOND %{https} !=on [NC]
RewriteRule     ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
ServerName isign-dev.gsk.com
</VirtualHost>


The above rule works fine when requests coming on 9080 port then 
1. Convert http://isign.abc.com/iSign/.... to https://isign.abc.com/iSign......
It works fine because the URL does not contain Port number.
2. It breaks when http requests url string includes the IP:Port and not just the Domain name. In the below example, the URL http://IP:9080/iSign/... gets converted to https://IP:9080/iSign/...But AWS https port in our case is configured to 9083 .


Can anyone help me rewrite rule based on my below requirements :


If request coming on 9080 port then 
1. Convert string http://isign.abc.com/iSign/.... to https://isign.abc.com/iSign......
That is, simply convert http to https.
2. Convert string http://IP:9080/iSign/... to https://IP:9083/iSign/.....


Your help on this is greatly appreciated.


Thanks,
Sudeep Pandey

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux