简体   繁体   English

反向代理的HTTPS重定向URL

[英]HTTPS Redirect URL with proxy reverse

I've a apache proxy reverse in front of a tomcat webapps with this vhost configuration 我使用此vhost配置在Tomcat Web应用程序之前使用了Apache代理反向

I need to redirect the http or https base url to a https stattics url like this : 我需要将http或https基本网址重定向到https统计网址,如下所示:

Redirect http:/ /xxx.domaine.tld TO https:/ /xxx.domaine.tld/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART; http:/ /xxx.domaine.tld重定向到https:/ /xxx.domaine.tld/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART;

and

Redirect https:/ /xxx.domaine.tld TO https:/ /xxx.domaine.tld/JOrgInet/JORGServlet? FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART; https:/ /xxx.domaine.tld重定向到https:/ /xxx.domaine.tld/JOrgInet/JORGServlet? FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART; https:/ /xxx.domaine.tld/JOrgInet/JORGServlet? FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART;

Here is the vhost configuration file 这是虚拟主机配置文件

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

when i acces to the base URL in http it's ok but how to redirect to the complex URL when I access with whith the https base URL... 当我访问http中的基本URL时可以,但是当我使用https基本URL访问时如何重定向到复杂URL ...

Thanks in advance. 提前致谢。

EB EB

You can use mod_rewrite to do what you want. 您可以使用mod_rewrite进行所需的操作。 In your SSL VirtuaLHost configuration, try something like this: 在您的SSL VirtuaLHost配置中,尝试执行以下操作:

RewriteEngine On
RewriteRule ^/$ https://%{SERVER_NAME}/JOrgInet/JORGServlet?FNAME=jorgentry.htt&P=LOCATION~FRA;DHTML~1;APPLI~ORGCHART; [R]

This matches requests for / only, and redirects them as requested via a client redirect. 这仅匹配/请求,并通过客户端重定向请求将其重定向。

For more information, take a look at the Apache URL rewriting guide . 有关更多信息,请参阅Apache URL重写指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM