You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ray Van Dolson <rv...@esri.com> on 2008/06/28 00:48:47 UTC

[users@httpd] mod_proxy_html rewriting query string portion of link

I'm attempting to use mod_proxy_html to rewrite internal URL's to the
corresponding external URL.  It seems to be working for the most part,
but I am having trouble getting the query string portion of a URL to be
processed.

My config:

  ProxyRequests off
  ProxyPreserveHost off

  ProxyHTMLLogVerbose On
  ProxyHTMLExtended On
  #SetEnv PROXY_HTML_FORCE

  # Custom links for use with mod_proxy_html
  ProxyHTMLLinks input value

  ProxyPass / http://st2.esri.com:8080/BAO30/

  ProxyHTMLURLMap http://st2.esri.com:8080/BAO30 http://external.esri.com [l]
  ProxyHTMLURLMap ^(https://.*)http://st2.esri.com:8080/BAO30(.*)$ $1http://external.esri.com$2 [R,l]

  <Location />
    ProxyPassReverse http://st2.esri.com:8080/BAO30/
    SetOutputFilter proxy-html
    ProxyHTMLURLMap /BAO30 /
    RequestHeader unset Accept-Encoding
  </Location>

I have ProxyHTMLLinks a href set in another configuration file.  The HTML
itself contains a line like this:

      <p class="acct"><a href="https://host.esri.com?fuseaction=LoginForgot;ReturnURL=http://st2.esri.com:8080/BAO30/main.map&amp;FailURL=http://st2.esri.com:8080/BAO30/main.map">Forgot your password?</a></p>
                                        
The st2.esri.com:8080/BAO30 is not getting rewritten in this URL.
Should this work?  I'm not sure if mod_html_proxy will handle arguments
to the URL (I don't see why it wouldn't).  Maybe my regex is confused
because of the multiple occurrences.

Any thoughts?

Ray

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_html rewriting query string portion of link

Posted by Ray Van Dolson <rv...@esri.com>.
On Fri, Jun 27, 2008 at 03:48:47PM -0700, Ray Van Dolson wrote:
> I'm attempting to use mod_proxy_html to rewrite internal URL's to the
> corresponding external URL.  It seems to be working for the most part,
> but I am having trouble getting the query string portion of a URL to be
> processed.

Hi all; figured this one out.  The syntax I ended up using is as
follows (with previous immediately preceeding)

<snip>

>   ProxyHTMLURLMap http://st2.esri.com:8080/BAO30 http://external.esri.com [l]
>   ProxyHTMLURLMap ^(https://.*)http://st2.esri.com:8080/BAO30(.*)$ $1http://external.esri.com$2 [R,l]

  ProxyHTMLURLMap (.*)http://st2.esri.com:8080/BAO30(/?.*) $1http://external.esri.com$2 [R,x,l]
  ProxyHTMLURLMap (.*)http://st2.esri.com:8080/BAO30(/?.*) $1http://external.esri.com$2 [R,x,l]

Had to specify the rule twice because the URL I want to replace
sometimes occurs twice in the anchor href element.  I didn't see a
better way to do this.

Also, using the "x" (POSIX regexp style) flag was key to getting it to
match anything.  The docs don't say what is used by default.  Perhaps
it was perl and I should have been using /stuff/?  In any case, so far
so good.

Ray

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org