RE: [users@httpd] ProxyPass with variables...

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

 



If it almost works, we are almost not going to change it.

Actually I do not understand how your configuration can possibly work for any other URL than http://app.mydomain.com/client1 which would be passed to the backend as http://client1.app.mydomain.com/b2b, whereas http://app.mydomain.com/client1/a/really/long/path would be passed to the backend as http://client1/a/really/long/path.app.mydomain.com/b2b. Am I right??

Furthermore, from what I understand, at some point the browser receives a redirection to  "http://client1.app.mydomain.com:8080/b2b";. That can be fixed with a ProxyPassReverse, but you will need to include one ProxyPassReverse for each client.

I would suggest something along the lines of:

<VirtualHost *:80>
    DocumentRoot /var/www/htdocs
    ServerName app.mydomain.com
    RewriteEngine On
    RewriteLog "/var/log/apache/rewrite.log"
    RewriteLogLevel 9
    RewriteRule ^/(.[^/]+)/(.*)  http://$1.app.mydomain.com:8080/b2b/$2 [P]

    ProxyPassReverse  http://app.mydomain.com/client1 http://client1.app.mydomain.com/b2b
    ProxyPassReverse  http://app.mydomain.com/client2 http://client2.app.mydomain.com/b2b
</VirtualHost>

The only reason I can think of causing "http://client1.app.mydomain.com:8080/b2b"; to appear on the browser's address bar, is that the backend server returns a redirection to that URL (HTTP 301, 302 or 303). In order to avoid this you need to rewrite the Location header in the response, and that is exactly what ProxyPassReverse does...

If you have the possibility to change the code of the backend application, I would recommend that instead of using a hostname containing the client's name, you would pass the client's name as an argument (query string) during session initialisation. Thereafter the JSESSIONID would identify the session context and thus the client. That would make your Apache configuration a lot simpler and you would not need to create one virtual host for each client.

-ascs

-----Original Message-----
From: Fabricio Luiz Machado [mailto:soproman@xxxxxxxxxxxx] 
Sent: Friday, June 17, 2005 4:31 AM
To: users@xxxxxxxxxxxxxxxx
Subject: RE: [users@httpd] ProxyPass with variables...

Hi, this is my vhost configuration:

<VirtualHost *:80>
    DocumentRoot /var/www/htdocs
    ServerName app.mydomain.com
    RewriteEngine On
    RewriteLog "/var/log/apache/rewrite.log"
    RewriteLogLevel 9
    RewriteRule ^/(.*)  http:/%{REQUEST_URI}.app.mydomain.com:8080/b2b
[P]
</VirtualHost>

 The application that runs on JBOSS, reads the profile template in URL name. Example: If I type "http://client1.app.mydomain.com:8080/b2b";, it loads client1´s template.
 So, I don´t want to force the client to type this complex url, but a simple like "http://app.mydomain.com/client1"; and make apache proxy these resquests to my application on JBOSS.
 The RewriteRule above is working, but it rewrites URL on browser´s address bar to "http://client1.app.mydomain.com:8080/b2b"; and I wan´t to preserver the address "http://app.mydomain.com/client1";.

Thanks again,

Fabricio.

---------------------------------------------------------------------
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