Issues with mod_rewrite and mod_proxy applying Redirect and Proxy

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 ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-21-2005
ek
 
Posts: n/a
Default Issues with mod_rewrite and mod_proxy applying Redirect and Proxy

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>

  #2 (permalink)  
Old 06-21-2005
HansH
 
Posts: n/a
Default Re: Issues with mod_rewrite and mod_proxy applying Redirect and Proxy

"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


  #3 (permalink)  
Old 06-21-2005
ek
 
Posts: n/a
Default Re: Issues with mod_rewrite and mod_proxy applying Redirect and Proxy

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0