You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by olivier giorgi <ol...@yahoo.fr.INVALID> on 2022/03/26 11:48:34 UTC

Apache : Redirect web requests - Keep the same host in the URL

Hello all,

The goal is that users willcontinue to connect to "https:/server1"but will actually browse to "https://server2".

I have successfullyredirected from "server1" to "server2" via apache/http, but the url seen in the browserchanges. 
 In the following configuration, how can I make this redirectioncompletely transparent to end users? <VirtualHost*:443>
ServerNameserver2

ServerAliasserver2

ErrorLog"C:\Apache24\logs/Error.log"

TransferLog"C:\Apache24\logs/access.log"

LogLevelwarn

 SSLEngineon

SSLProxyEngineOn

 SSLCertificateFile"E:\certificat\proxy\server2.cer"

SSLCertificateKeyFile"E:\certificat\proxy\server2.dsone.3ds.com_self.key"

 ProxyPass/3dpassport "https://server1/3dpassport"

ProxyPassReverse /3dpassport "https://server1/3dpassport"

 

</VirtualHost>

 

Good week-end !

 


Re: [OT] Apache : Redirect web requests - Keep the same host in the URL

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Olivier,

Marking off-topic because this is about Apache httpd and not Apache 
Tomcat, but it's fine.

See below.

On 3/26/22 07:48, olivier giorgi wrote:
> The goal is that users willcontinue to connect to "https:/server1"but will actually browse to "https://server2".
> 
> I have successfullyredirected from "server1" to "server2" via apache/http, but the url seen in the browserchanges.
>   In the following configuration, how can I make this redirectioncompletely transparent to end users? <VirtualHost*:443>
> ServerNameserver2
> 
> ServerAliasserver2
> 
> ErrorLog"C:\Apache24\logs/Error.log"
> 
> TransferLog"C:\Apache24\logs/access.log"
> 
> LogLevelwarn
> 
>   SSLEngineon
> 
> SSLProxyEngineOn
> 
>   SSLCertificateFile"E:\certificat\proxy\server2.cer"
> 
> SSLCertificateKeyFile"E:\certificat\proxy\server2.dsone.3ds.com_self.key"
> 
>   ProxyPass/3dpassport "https://server1/3dpassport"
> 
> ProxyPassReverse /3dpassport "https://server1/3dpassport"
> 
>   
> 
> </VirtualHost>

You're on the right track, here, but it's not clear which server's 
configuration file is being shown above.

If you want users to type "server1" but the information really comes 
from "server2", then you want to configure server1 like this:

<VirtualHost *:443>
   ServerName server1
   ServerAlias server2

   ...

   ProxyPass        /3dpassport https://server2/3dpassport
   ProxyPassReverse /3dpassport https://server2/3dpassport
</VirtualHost>

This will configure server1 as a reverse-proxy for server2, but only for 
the /3dpassport URL-space. If you want to proxy *everything*, you can just:

   ProxyPass        / https://server2/
   ProxyPassReverse / https://server2/

Hope that helps,
-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: Apache : Redirect web requests - Keep the same host in the URL

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.

> -----Ursprüngliche Nachricht-----
> Von: olivier giorgi <ol...@yahoo.fr.INVALID>
> Gesendet: Samstag, 26. März 2022 12:49
> An: Tomcat Users List <us...@tomcat.apache.org>
> Betreff: Apache : Redirect web requests - Keep the same host in the URL
> 
> 
> Hello all,
> 
> The goal is that users willcontinue to connect to "https:/server1"but will
> actually browse to "https://server2".
> 
> I have successfullyredirected from "server1" to "server2" via apache/http,
> but the url seen in the browserchanges.
>  In the following configuration, how can I make this redirectioncompletely
> transparent to end users? <VirtualHost*:443>
> ServerNameserver2
> 
> ServerAliasserver2
> 
> ErrorLog"C:\Apache24\logs/Error.log"
> 
> TransferLog"C:\Apache24\logs/access.log"
> 
> LogLevelwarn
> 
>  SSLEngineon
> 
> SSLProxyEngineOn
> 
>  SSLCertificateFile"E:\certificat\proxy\server2.cer"
> 
> SSLCertificateKeyFile"E:\certificat\proxy\server2.dsone.3ds.com_self.key"
> 
>  ProxyPass/3dpassport "https://server1/3dpassport"
> 
> ProxyPassReverse /3dpassport "https://server1/3dpassport"
> 
> 
> 
> </VirtualHost>
> 
> 
> 
> Good week-end !


Hello,
I think "redirect" is the wrong way or method. Redirect will always tell the browser to go to another URL.
If you want to have a transparent behaviour, you need to just proxy the request to the target server.
E.g. on Server1 runs Apache webserver and the webserver will proxy the incoming request to server2 in the background.
SSL must be handled by server1 because apache must be able to read the request. Depending on the environment / security
the target server can use http or https.
Also take care of websockets, if they are used. They need additional rules.

Maybe it's more a question about Apache and less about Tomcat.

Greetings,
Thomas