apache - How to exclude a URL from HTTPS -


i have tried different links see if works, doesn't seems work. have configured https on redhat el6. wanted have exception 1 of ip.

i wanted have https enabled except 1 ip 192.168.1.1. when access url ip 192.168.1.1, should redirected or rewritten http://cab.abc.com , not https://cab.abc.com

snip of /etc/httpd/conf/httpd.conf :

<virtualhost *:80>     documentroot /opt/app/cr/public     servername cab.abc.com     rewriteengine on     rewritelog /var/tmp/rewrite.log     rewriteloglevel 5     rewritecond %{remote_addr} ^192\.168\.1\.1     # rewriterule .*  http://cab.abc.com%{request_uri} [r]     # rewriterule ^/(.*) http://cab.abc.com%{request_uri} [r]     rewriterule .* http://cab.abc.com [l]     rewritecond %{the_request} ^(.*)     rewriterule .*  https://cab.abc.com%{request_uri} [r]     # proxypass / https://cab.abc.com/     # proxypassreverse / https://cab.abc.com/ </virtualhost> 

i have tried multiple options , checked rewrite.log file :

192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (2) rewrite '/' -> 'http://cab.abc.com' 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (2) implicitly forcing redirect (rc=302) http://cab.abc.com 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (1) escaping http://cab.abc.com redirect 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (1) redirect http://cab.abc.com [redirect/302] 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (2) init rewrite engine requested uri / 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (3) applying pattern '.*' uri '/' 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (4) rewritecond: input=‘192.168.1.1’ pattern='^192\\.168\\.1\\.1’ => matched 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (2) rewrite '/' -> 'http://cab.abc.com' 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (2) implicitly forcing redirect (rc=302) http://cab.abc.com 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (1) escaping http://cab.abc.com redirect 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c9b48/initial] (1) redirect http://cab.abc.com [redirect/302] 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c5b28/initial] (2) init rewrite engine requested uri / 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c5b28/initial] (3) applying pattern '.*' uri '/' 192.1681.1 - - [21/apr/2016:20:36:01 +0000] [cab.abc.com/sid#7fe3e21fe2e0][rid#7fe3e24c5b28/initial] (4) rewritecond: input=‘192.1681.1.’ pattern='^192\\.168\\.1\\.1’ => matched 

requesting exclude ip address https.

try these rules after clearing browser cache:

rewriteengine on  rewritecond %{https} off rewritecond %{remote_addr} !=192.168.1.1 rewriterule ^ https://cab.abc.com%{request_uri} [r,l,ne]  rewritecond %{remote_addr} =192.168.1.1 rewriterule ^ http://cab.abc.com%{request_uri} [r,l,ne] 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -