This is a discussion on Issues with mod_rewrite and mod_proxy applying Redirect and Proxy within the Apache Web Server forums, part of the Web Server and Related Forums category; I need to redirect from http://myste.com/secure (if attempted) to: https://mysite.com/secure However, this directory does ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I need to redirect from
http://myste.com/secure (if attempted) to: https://mysite.com/secure However, this directory does not exist on my apache, but does exist on iis running on port 8080, and needs to be proxy'd to http://mysite:8080/secure I have the following code below, but the ProxyPass and ProxyPassReverse seems to be firing before Rewrite section. If the ProxyPass fires first, the mod_rewrite does not come into effect, and it does not apply the https rule. Is there anyway to make rewrite to fire first? Note: I've also tried adding another rewrite rule to proxy to my 8080 site after the redirect, but this didn't work either. I may not have written it correctly. I'm running 1.3 series on Windows. Any ideas are appreciated. <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^/secure(.*)$ https://mysite.com/secure$1 [R] </IfModule> <IfModule mod_proxy.c> ProxyRequests Off ProxyPass /secure/ http://mysite.com:8080/secure/ ProxyPassReverse /secure/ http://mysite.com:8080/secure/ <Directory proxy:*> Order deny,allow Allow from all </Directory> </IfModule> |
|
|||
|
"ek" <erdal@iprimus.com.au> schreef in bericht
news:1119323025.754153.22410@g49g2000cwa.googlegro ups.com... > I need to redirect from > http://myste.com/secure (if attempted) to: > https://mysite.com/secure > ... and needs to be proxy'd to > http://mysite:8080/secure > Is there anyway to make rewrite to fire first? I assume you already have setup two vhost, one listening at port 80(http), the other at port 443(https). Move the rewrite directives into the the first <virtualhost *:80> ... </virtualhost> and the proxy directive into the other: <virtualhost *:443> .... </virtualhost> section. > ... I'm running 1.3 series on Windows. > <IfModule mod_rewrite.c> > RewriteEngine on > RewriteCond %{HTTPS} !=on Syntax looks unfamiliar, I 'ld have used RewriteCond %{SERVER_PROTOCOL}!^https$ [NC] http://httpd.apache.org/docs/mod/mod...ml#RewriteCond > RewriteRule ^/secure(.*)$ https://mysite.com/secure$1 [R] > </IfModule> > > <IfModule mod_proxy.c> > ProxyRequests Off > ProxyPass /secure/ http://mysite.com:8080/secure/ > ProxyPassReverse /secure/ http://mysite.com:8080/secure/ > </IfModule> Apache and ISS are running on the same machine? HansH |
|
|||
|
That worked, thanks a lot!
Yes, I'm running IIS and Apache on the same machine Yes, apache is listening on both ports 80 and 443 I have the IIS running on ports 8080 and 442 > RewriteCond %{HTTPS} !=on > Syntax looks unfamiliar, I 'ld have used RewriteCond %{SERVER_PROTOCOL}!^https$ [NC] I just got the syntax from the web and works OK. Thanks again for your help |
| Thread Tools | |
| Display Modes | |
|
|