RE: [users@httpd] apache 2.0 as reverse proxy using mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HTTP 302 is not an error: it is a redirection. The thing which is wrong with that is the Location header which makes a reference to a server which is not known to the clients: webserver-internal. In other words, the backend server tells the browser to make a request for http://webserver-internal/dealer/sso/login. The browser tries to reach webserver-internal but fails to do so.

In order for the Location header in the response to be rewritten, you need to add the following line to your configuration:

ProxyPassReverse / http://webserver-internal/

Then, when the 302 response reaches the browser, the Location header will contain http://webserver/dealer/sso/login.

You can probably remove the line
    ProxyPassReverse / http://ip-address/
although it probably does not hurt to leave it.


-ascs

-----Original Message-----
From: Heitmann, Herwarth [mailto:herwarth.heitmann@xxxxxxxxxxxxx] 
Sent: Friday, June 24, 2005 1:01 PM
To: users@xxxxxxxxxxxxxxxx
Subject: RE: [users@httpd] apache 2.0 as reverse proxy using mod_rewrite

Ok I made a mistake in the initial question

When someone goes to https://webserver it has to be redirected to http://webserver-internal/dealer/start

You were right on https://login it has no subdirectory redirect and this works without the rewrite...

I got the following 302 found error from the browser (with header display tool)

HTTP/1.1 302 Found
Date: Fri, 24 Jun 2005 10:43:25 GMT
Server: Apache/1.3.26 (Unix)
Location: http://webserver-internal/dealer/sso/login;DAX_SESSION_COOKIE=C7kFPYZikF3EPG3aKAHBhK2F8JTlnu3lZPk1pcX6A22NluGlzkFK!398064258!175689490!8000!7002
Set-Cookie: DAX_SESSION_COOKIE=C7kFPYZikF3EPG3aKAHBhK2F8JTlnu3lZPk1pcX6A22NluGlzkFK!398064258!175689490!8000!7002; path=/dealer
Content-Type: text/plain; charset=UTF-8
Connection: close
Transfer-Encoding: chunked

So it goes to the right server but it ends at dealer/sso.... With the following rewrite rule in the virtual host webserver:

<VirtualHost ip-address:443>
    ServerAdmin webmaster@webserver
    ServerName webserver
    ProxyPass / http://webserver-internal/
    ProxyPassReverse / http://ip-address/
    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl.crt/webserver.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/webserver.key
    ErrorLog logs/error_log_webserver
    TransferLog logs/access_log_webserver

    RewriteEngine On
    RewriteRule ^/$ https://webserver/dealer/start [R,L]

</VirtualHost>


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux