
Tenemos una aplicación heredada con URL https://www2.devDocApp.com/
que se está ejecutando Ubuntu8
y apache2.2
sin soporte para TLS 1.2, tuvimos dificultades para actualizar apache2.2
y openSSL en Ubuntu 8, por lo que ahora estamos como apache
servidor proxy ( devapp01
Windows 2012 VM con Apache/2.4.29 (Win64) ) que redirige todas las solicitudes ahttps://www2.devDocApp.com/
A continuación se muestra la configuración de Apache que he usado para configurar el servidor proxy.devapp01
<VirtualHost *:443>
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
DocumentRoot "C:/apache/htdocs"
ServerName devapp01
#ErrorLog "|bin/rotatelogs.exe -l -f C:/apache/logs/apache_error_log.%m-%d-%y-%I-%M-%S.log 86400"
#TransferLog "|bin/rotatelogs.exe -l -f C:/apache/logs/apache_transfer_log.%m-%d-%y-%I-%M-%S.log 86400"
SSLEngine on
#SSLProtocol -ALL +TLSv1 +TLSv1.1 +TLSv1.2
#SSLHonorCipherOrder on
#SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
#SSLCompression off
SSLProtocol -ALL TLSv1.2
SSLCertificateFile "C:/apache/conf/server.cer"
SSLCertificateKeyFile "C:/apache/conf/server.key"
#SSLCertificateChainFile "C:/apache/conf/server-ca.cer"
SSLCACertificateFile "C:/apache/conf/ca.cer"
SSLVerifyClient optional
SSLVerifyDepth 3
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
#CustomLog "|bin/rotatelogs.exe C:/apache/logs/ssl_request.%m-%d-%Y_%H_%M_%S.log 86400" \
# "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
#ProxyPass should be prior to any other Proxy directives
ProxyPass /DocApp https://www2.devDocApp.com/
SSLProxyEngine on
RewriteEngine On
RewriteRule ^/DocApp$ https://www2.devDocApp.com/ [R,L]
RequestHeader set X_SSL_CLIENT_M_SERIAL "%{SSL_CLIENT_M_SERIAL}s"
RequestHeader set X_FORWARDED_PROTO "https" env=HTTPS
RequestHeader set SslSubject "%{SSL_CLIENT_S_DN}s"
</VirtualHost>
Cuando accedo a la URL del proxy Apache https://devapp01/DocApp/
a la que se redirige https://www2.devDocApp.com/
en el navegador, ¿cómo puedo hacer que funcione de tal manera que la URL en el navegador siempre sea https://devapp01/DocApp/<Page>
para todas las rutas anidadas, como https://devapp01/DocApp/page1
https://devapp01/DocApp/page2/page1
en lugar de redirigir a https://www2.devDocApp.com/page1
, https://www2.devDocApp.com/page2
etc.?
Respuesta1
Esto hace la redirección:
RewriteEngine On
RewriteRule ^/DocApp$ https://www2.devDocApp.com/ [R,L]
Retírelo. El ProxyPass
ya funciona.
Respuesta2
deberías probar el proxy de esta manera
RewriteEngine on
RewriteRule "^DocApp/(.*)$" "https://www2.devDocApp.com/DocApp/$1" [P]
ProxyPassReverse "/DocApp/" "http://www2.devDocApp.com/DocApp/"
Agregamos una directiva ProxyPassReverse para garantizar que cualquier redireccionamiento emitido por el backend se transmita correctamente al cliente.
mejor información aquí: https://httpd.apache.org/docs/2.4/rewrite/proxy.html