【问题标题】:Redirect http to https by configuring .conf file of apache通过配置apache的.conf文件将http重定向到https
【发布时间】:2012-05-07 07:09:46
【问题描述】:

我已经通过类似代码将 apache 配置为 tomcat 配置

<VirtualHost *:80>
ServerName captiveportal
ProxyPass       / http://ip:port/path
ProxyPassReverse / http://ip:port/path
</VirtualHost>

现在我想将此请求重新发送到 https 我怎样才能做到这一点?

查看您的答案后,我更改了我的配置,例如

<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/httpd/conf/crt1.crt"
SSLCertificateKeyFile "/etc/httpd/conf/key1.key"
ProxyPass       / http://ip:port/path
</VirtualHost>
<VirtualHost *:80>
ServerName captiveportal
Redirect / https://ip:port/path
</VirtualHost>

但是当我在浏览器上输入captiveportal 时,它会将我重定向到网址https://ip:port/path 并显示problem loading page

还有一件事我不想在浏览器上显示https://ip:port/path

注意:-https://ip:port/path 其中 port 是我的 tomcat 端口,ip 是运行 tomcat 的机器 ip。

【问题讨论】:

    标签: apache http tomcat https proxy


    【解决方案1】:

    你可以这样做:

    <VirtualHost *:80>
       ServerName captiveportal
       Redirect / https://my.host.name/
    </VirtualHost>
    

    ...然后将您的 ProxyPass 指令放在您的 SSL VirtualHost 块中。

    【讨论】:

    • 请检查已编辑的问题,因为我已根据您的建议进行更改并面临其他问题。
    • 你可能应该重定向到https://captiveportal/,这就是我在这里试图提出的建议。
    猜你喜欢
    • 2020-04-11
    • 2019-11-08
    • 2017-12-24
    • 2018-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多