This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Problem with a proxy rule
Author
Message |
rlejeune
Newbie


Joined: 29 November 2011
Posts: 5
Posted: 29 November 2011 at 8:42am

Hi

I have two DNS:
www.site1.com
www.site2.com/virtualdir

I have a rule that redirect www.site1.com to the virtual
directory on site2. Here is my rule

RewriteCond %{HTTP_HOST} ^(?:www\.)?site1\.com$ [NC]
RewriteProxy ^(.*)?$ http\://www.site2.com/virtualdir/en/$1 [NC,U]

The rule works fine when a user type site1.com he is
redirected to site2.com and his original URL is kept.
But as soon as he click on any link that does a
response.redirect they do not work. Is it normal that I
have to have special response.redirect in my code because
of the proxy rule? I always though that it was
transparent when we were adding a rule. Or maybe I have
something wrong with my rule.

Thanks in advance!

Edited by rlejeune - 30 November 2011 at 7:42am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 30 November 2011 at 3:29am

Please, provide the rewrite.log for testing request. This will help us to understand the nature of the issue.
Logging issues described in FAQ

Regards
Andrew
Back to Top
 
rlejeune
Newbie


Joined: 29 November 2011
Posts: 5
Posted: 30 November 2011 at 7:43am

Here is the log file, I removed the IP address from it,
but everything else is there.

From what I can see, the problem is that the rule add the
virtual directory twice "virtualdir/en/virtualdir/en/"
but I just don't get why tho ...

Thanks

Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) init rewrite engine with requested uri /plan-retraite.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (3) applying pattern '^(.*)?$' to uri 'plan-retraite.aspx'
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (4) RewriteCond: input='www.site1.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => matched
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) forcing proxy-throughput with http://www.site2.com/virtualdir/en/plan-retraite.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) go-ahead with proxy request http://www.site2.com/virtualdir/en/plan-retraite.aspx [OK]
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) rewrite 'plan-retraite.aspx' -> '/plan-retraite.aspxx.rwhlp?p=0'Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) internal redirect with
/plan-retraite.aspxx.rwhlp?p=0 [INTERNAL REDIRECT]

Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (2) init rewrite engine with requested uri /virtualdir/en/plan-retraite.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (3) applying pattern '^(.*)?$' to uri 'virtualdir/en/plan-retraite.aspx'
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (4) RewriteCond: input='www.site2.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => not-matched
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) init rewrite engine with requested uri /virtualdir/en/style-vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (3) applying pattern '^(.*)?$' to uri 'virtualdir/en/style-vie.aspx'
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (4) RewriteCond: input='www.site1.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => matched
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) forcing proxy-throughput with http://www.site2.com/virtualdir/en/virtualdir/en/style-vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (1) go-ahead with proxy request http://www.site2.com/virtualdir/en/virtualdir/en/style-vie.aspx [OK]
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) rewrite 'virtualdir/en/style-vie.aspx' -> '/virtualdir/en/style-vie.aspxx.rwhlp?p=0'
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20914408/initial] (2) internal redirect with /virtualdir/en/style-vie.aspxx.rwhlp?p=0 [INTERNAL REDIRECT]

Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (2) init rewrite engine with requested uri /virtualdir/en/virtualdir/en/style-vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (3) applying pattern '^(.*)?$' to uri 'virtualdir/en/virtualdir/en/style-vie.aspx'
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20915592/initial] (4) RewriteCond: input='www.site2.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => not-matched
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (2) init rewrite engine with requested uri /virtualdir/page_erreur.html?aspxerrorpath=/virtualdir/en/virtualdir/en/style-vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (3) applying pattern '^(.*)?$' to uri 'virtualdir/page_erreur.html'
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (4) RewriteCond: input='www.site1.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => matched
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (2) forcing proxy-throughput with http://www.site2.com/virtualdir/en/virtualdir/page_erreur.html?aspxerrorpath=/virtualdir/en/virtualdir/en/style- vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (1) go-ahead with proxy request http://www.site2.com/virtualdir/en/virtualdir/page_erreur.html?aspxerrorpath=/virtualdir/en/virtualdir/en/style- vie.aspx [OK]
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (2) rewrite 'virtualdir/page_erreur.html' -> '/virtualdir/page_erreur.htmlx.rwhlp?p=0'
Wed, 30-Nov-2011 08:34:05 GMT [www.site1.com/sid#44][rid#20915592/initial] (2) internal redirect with /virtualdir/page_erreur.htmlx.rwhlp?p=0 [INTERNAL REDIRECT]

Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20914408/initial] (2) init rewrite engine with requested uri /virtualdir/en/virtualdir/page_erreur.html?aspxerrorpath=/virtualdir/en/virtualdir/en/style-vie.aspx
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20914408/initial] (1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20914408/initial] (1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20914408/initial] (3) applying pattern '^(.*)?$' to uri 'virtualdir/en/virtualdir/page_erreur.html'
Wed, 30-Nov-2011 08:34:05 GMT [www.site2.com/sid#44][rid#20914408/initial] (4) RewriteCond: input='www.site2.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => not-matched
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 01 December 2011 at 5:33am

If I'm right - piece of cake.

Try using the following:

RewriteCond %{HTTP_HOST} ^(?:www\.)?site1\.com$ [NC]
RewriteProxy ^(.*)?$ http\://www.site2.com/virtualdir/en/$1 [NC,U,L]

It'll prevent the request from further processing.

Regards
Andrew
Back to Top
 
rlejeune
Newbie


Joined: 29 November 2011
Posts: 5
Posted: 01 December 2011 at 7:18am

Hi Andrew

Sadly it didn't do the trick. One little thing that might
be important is that I am using ImageButton in .Net and
they are doing a Postback to the actual page, which when it
intercept the click of the button does a redirect to
another page. Maybe this is why Isapi Rewrite react like
that?

Thanks!
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 01 December 2011 at 8:28am

Well, here's an extract from the log:

Code:
----- SITE1 LOG ---------------------
(2) init rewrite engine with requested uri /plan-retraite.aspx
(1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
(3) applying pattern '^(.*)?$' to uri 'plan-retraite.aspx'
(4) RewriteCond: input='www.site1.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => matched
(2) forcing proxy-throughput with http://www.site2.com/virtualdir/en/plan-retraite.aspx
(1) go-ahead with proxy request http://www.site2.com/virtualdir/en/plan-retraite.aspx [OK]
(2) rewrite 'plan-retraite.aspx' -> '/plan-retraite.aspxx.rwhlp?p=0'(2) internal redirect with
/plan-retraite.aspxx.rwhlp?p=0 [INTERNAL REDIRECT]
-------------------------------------

----- SITE2 LOG ---------------------
(2) init rewrite engine with requested uri /virtualdir/en/plan-retraite.aspx
(1) Htaccess process request D:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request e:\projets\epargnecollective\ice\ice dev\axe3\ice\axe a\solutions\.htaccess
(3) applying pattern '^(.*)?$' to uri 'virtualdir/en/plan-retraite.aspx'
(4) RewriteCond: input='www.site2.com' pattern='^(?:www\.)?yourwaymobile-fonc\.ca$' => not-matched

---------------------------------------

Everything looks legit. But the thing is that I noticed you have same .htaccess for both sites. Correct? Why?

Regards
Andrew
Back to Top
 
rlejeune
Newbie


Joined: 29 November 2011
Posts: 5
Posted: 01 December 2011 at 8:56am

I have two DNS, but only one web site. site1.com doesn't
exist I only own the DNS which is why. site2 is the wenb
site with the htaccess file
Back to Top
 
rlejeune
Newbie


Joined: 29 November 2011
Posts: 5
Posted: 02 December 2011 at 6:54am

Just to clarify my answer, I have a web site which only serve as a redirection web
site, which is on a server. This is the IP address where site1.com goes. This site
has the htaccess file.

On my web server I have site2.com, which as another ip address, and I want to
redirect all the traffic to it, this site doesn't have any htaccess file at all.

Something like this.

Internet --> Redirect server(site1.com) --> web server(site2.com)
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 06 December 2011 at 6:58am

Seems like both domains are ruled by one .htaccess file.
In case you want to proxy all requests through site one, you do not need these rules for site2.

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version