Apache 代理不重定向

Apache 代理不重定向,apache,ssl,redirect,proxy,Apache,Ssl,Redirect,Proxy,我有以下Apache配置文件。当有人输入时,它不会将他们重定向到https。为什么? <VirtualHost *:80> ProxyPreserveHost On ProxyPass "/" "http://10.0.1.123/" ProxyPassReverse "/" "http://10.0.1.123/" ServerName www.mywebsite.com

我有以下Apache配置文件。当有人输入时,它不会将他们重定向到https。为什么?

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass "/" "http://10.0.1.123/"
    ProxyPassReverse "/" "http://10.0.1.123/"
    ServerName www.mywebsite.com
    ServerAlias mywebsite.com
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =mywebsite.com
    RewriteCond %{SERVER_NAME} =www.mywebsite.com
    RewriteRule ^ https://mywebsite.com%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    SSLProxyEngine on
    ProxyPreserveHost On
    ProxyPass "/" "http://10.0.1.123:80/"
    ProxyPassReverse "/" "http://10.0.1.123:80/"
    ServerName www.mywebsite.com
    ServerAlias mywebsite.com
    ServerAdmin admin_ws1@mywebsite.com
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/www.mywebsite.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.mywebsite.com/privkey.pem
</VirtualHost>

代理主机
代理过程“/”http://10.0.1.123/"
ProxyPassReverse“/”http://10.0.1.123/"
服务器名www.mywebsite.com
ServerAlias mywebsite.com
重新启动发动机
RewriteCond%{SERVER_NAME}=mywebsite.com
重写cond%{SERVER_NAME}=www.mywebsite.com
重写规则^https://mywebsite.com%{REQUEST_URI}[END,NE,R=permanent]
斯伦金安
SSLProxyEngine打开
代理主机
代理过程“/”http://10.0.1.123:80/"
ProxyPassReverse“/”http://10.0.1.123:80/"
服务器名www.mywebsite.com
ServerAlias mywebsite.com
服务器管理员_ws1@mywebsite.com
Include/etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile/etc/letsencrypt/live/www.mywebsite.com/fullchain.pem
SSLCertificateKeyFile/etc/letsencrypt/live/www.mywebsite.com/privkey.pem

... 
代理过程“/”http://10.0.1.123/"
...
重写规则^https://mywebsite.com%{REQUEST_URI}[END,NE,R=permanent]
ProxyPass
告诉Apache充当反向代理,并将请求转发到真正的服务器。相反,
重写规则告诉Apache通过重定向到站点的HTTPS版本来回答请求本身。显然,它不能同时做到这两个方面,因此存在冲突。请删除代理规则*
并仅保留端口80上的重写规则。


... 
代理过程“/”http://10.0.1.123/"
...
重写规则^https://mywebsite.com%{REQUEST_URI}[END,NE,R=permanent]

ProxyPass
告诉Apache充当反向代理,并将请求转发到真正的服务器。相反,
重写规则告诉Apache通过重定向到站点的HTTPS版本来回答请求本身。显然,它不能同时做到这两个方面,因此存在冲突。请删除
Proxy*
规则,只保留端口80上的
Rewrite*
规则。

非常感谢。听起来很明显,但你没有解释;)非常感谢你。听起来很明显,但你没有解释;)
<VirtualHost *:80>
    ... 
    ProxyPass "/" "http://10.0.1.123/"
    ...
    RewriteRule ^ https://mywebsite.com%{REQUEST_URI} [END,NE,R=permanent]