logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Rewrite Module Help
Author
bushman



Joined: 13 Apr 2006
Posts: 4

PostPosted: Thu 13 Apr '06 21:28    Post subject: Rewrite Module Help Reply with quote

I have been banging my head into the desk on this one all day... I've got to be missing something stupid.

I have a subdirectory on my site that is reverse proxying to another web site running on a different port, with its own built in web server. I do not have access to the code of this application.

I have successfully gotten almost everything to work properly, with a combination of ProxyPass, ProxyPassRevers, and mod_proxy_html... With one exception:
Every 60 seconds, this application refreshes itself. It does so (unfortunately) through a piece of JaveScript code, not through a refresh meta tag, so ProxyPassReverse misses it.

It attempts to refresh to /index.xsp, when instead, I want it to refresh to /switchboard/index.xsp.

So what I am trying to do, is come up with a re-write rule that says:
"If a request comes in, refered from '/switchboard/', for '/index.xsp', rewrite it to /switchboard/index.xsp"

The reason I added the "referer" to the mix is that there are actually multiple apps, all programmed by the same person, running on different ports. They all do the same thing, requesting their own /index.xsp every 60 seconds, so if I can work out how to do it for one, with the referer, I can do it for all of them.

Here's what I have so far:

Code:
#Proxy to Switchboard   
ProxyPass /switchboard http://192.168.64.2:52340
ProxyHTMLURLMap http://192.168.64.2:52340 /switchboard
<Location /switchboard>
ProxyPassReverse /
SetOutputFilter   proxy-html
ProxyHTMLURLMap   web   /switchboard/web   
ProxyHTMLURLMap   /   /switchboard/
ProxyHTMLURLMap   /switchboard   /switchboard
RequestHeader   unset   Accept-Encoding
</Location>


And I tried this:
Code:
RewriteCond   %{HTTP_REFERER}   switchboard
RewriteCond   ^(.*)   /index.xsp
RewriteRule   /   /switchboard/index.xsp [P,L]


But that failed. I see, in the Rewrite Log:
Code:
(3) applying pattern '/' to uri '/inprogress.xxml'
(4) RewriteCond: input='http://secure.websitename.com/switchboard' pattern='switchboard' => matched
(4) RewriteCond: input='^(.*)' pattern='/index.xsp' => not-matched
(3) applying pattern '^/(.*)$' to uri '/inprogress.xxml'
(4) RewriteCond: input='inprogress.xxml' pattern='[A-Z]' => not-matched
(1) pass through /inprogress.xxml


(the Additional Rewrites are rules that are set to translate all URIs to Lowercase)

Can anyone offer a suggestion as to what I'm doing wrong? It looks like, in the third line of the log file above, it doesn't match because it is using the /inprogress.xxml as the URI, and what was actually submitted.

Sorry if this has been asked and answered... I've searched, and not found anything like it.

Thanks,

Glenn
Back to top
bushman



Joined: 13 Apr 2006
Posts: 4

PostPosted: Mon 17 Apr '06 17:02    Post subject: Reply with quote

I figured it out...

Turns out that there is no reliable way to have a redirect pass a referer, so what I want to do is not possible.

I have requested that the developer change the app to request the full URI of the index page (with IP address and Port Number) and then my first ProxyPassHTMLURLMap will catch and re-write it.

Thanks anyway,

Bushman
Back to top


Reply to topic   Topic: Rewrite Module Help View previous topic :: View next topic
Post new topic   Forum Index -> Apache