You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chet Luther <ch...@rcn.com> on 2002/04/05 02:12:40 UTC

[mod_rewrite] Problems with an initially empty URL.

Users,
    First off, my relevant information:  Apache 1.3.22 (Using this version
because of single cookie bug in 23/24.) on Solaris 8.
    I am attempting to proxy a PeopleSoft web application that has the
annoying habit of constructing escaped HREF and SRC attributes like such:

http%3a%2f%2fps-web.mycorp.net%3a8800%2fservlets%2ficlientservlet%2fpeopleso
ft8portal%2f

    This causes my rewrite rules to treat it as a relative URL although it
should really be absolute.  These improperly escaped URLs end up getting
rewritten into something like this:

/servlets/psportal/peoplesoft8portal/http://ps-web.mycorp.net:8800/servlets/
iclientservlet/peoplesoft8portal/

The relevant portion of my httpd.conf:

> ServerName ps-web.mycorp.net
> Listen 8800
>
> CustomLog /path/to/apache/logs/custom.log "\n%p) %U%q\n%p) %{REWRITE}e\n"
> TransferLog /path/to/apache/logs/custom.log
>
> RewriteEngine On
> RewriteRule ^(.*)$ $1 [E=REWRITE:$1]
> RewriteRule ^/(.*)$  to://medusa.corp.rcn.net:8800/$1
> RewriteRule ^to://([^/]+)/(.*)   http://$1/$2 [E=SERVER:$1,P,L]
> RewriteRule .*  -  [F]
>
> ProxyRequests On
> NoCache *
>
> ProxyPassReverse /  http://ps-web.mycorp.net:8800/

An example log snippet showing the empty URL string mod_rewrite is seeing.
The top line is generated by the TransferLog directive, and the bottom by
the RewriteLog.

> 443)
/servlets/psportal/peoplesoft8portal/http://ps-web.mycorp.net:8800/servlets/
iclientservlet/peoplesoft8portal/
> 443) -

An example log snippet of a URL that wasn't escaped:

> 443) /servlets/iclientservlet/peoplesoft8portal/
> 443) /servlets/iclientservlet/peoplesoft8portal/

    My first reaction would be to just add another rewrite rule to properly
rewrite in this case, but I can't rewrite a URL that doesn't exist.  Any
suggestions would be very welcome.

Thanks in advance,

Chet Luther
chet@rcn.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org