我在具有此 vhost 配置的 tomcat webapps 前面有一个 apache 代理反向
我需要将 http 或 https 基本 url 重定向到 https 统计 url,如下所示:
重定向 http://xxx.domaine.tld
到 https://xxx.domaine.tld/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~ 1;APPLI~组织结构图;
和
重定向 https://xxx.domaine.tld
到 https://xxx.domaine.tld/JOrgInet/JORGServlet?
FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART;
这是虚拟主机配置文件
<Virtualhost *:80>
ServerName org.domaine.tld
Redirect / https://org.domaine.tld/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART;
</Virtualhost>
<VirtualHost *:443>
ServerName org.domaine.tld:443
ErrorLog /var/log/apache2/domaine.tld.error.log
CustomLog /var/log/apache2/domaine.tld.log combined
LogLevel warn
SSLProxyEngine on
SSLCACertificateFile /etc/apache2/certs/gs_root.pem
SSLCertificateChainFile /etc/apache2/certs/intermediate.pem
SSLCertificateFile /etc/apache2/certs/gscert.pem
SSLCertificateKeyFile /etc/apache2/certs/gscert.key
<Location />
AuthType Basic
AuthBasicProvider ldap
AuthName "Login LDAP SERVER"
AuthLDAPURL "ldap://xxx.xxx.xxx.xxx:389/o=XXXXXXXXXXX?uid"
Require valid-user
AuthLDAPRemoteUserAttribute uid
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule .* - [E=RU:%1]
RequestHeader set REMOTE_USER %{RU}e
</Location>
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheDefaultExpire 3600
CacheEnable disk /
CacheRoot "/var/cache/apache2"
CacheDirLevels 2
CacheDirLength 1
CacheMaxFileSize 1000000
CacheMinFileSize 1
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreQueryString Off
CacheIgnoreHeaders None
CacheLastModifiedFactor 0.1
CacheDefaultExpire 3600
CacheMaxExpire 86400
CacheStoreNoStore On
CacheStorePrivate On
</IfModule>
</IfModule>
ProxyPass / ajp://xxx.xxx.xxx.xxx:8009/
ProxyPassReverse / https://org.domaine.tld/
</VirtualHost>
当我访问 http 中的基本 URL 时没问题,但是当我使用 https 基本 URL 访问时如何重定向到复杂的 URL...
提前致谢
B
最佳答案
你可以使用 mod_rewrite
来做你想做的事。在您的 SSL VirtuaLHost 配置中,尝试如下操作:
RewriteEngine On
RewriteRule ^/$ https://%{SERVER_NAME}/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART; [R]
这仅匹配对 /
的请求,并通过客户端重定向根据请求重定向它们。
有关更多信息,请查看 Apache URL rewriting guide .
关于apache - 带代理反向的 HTTPS 重定向 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10385055/