Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在内部代理上设置apache HTTP到HTTPS重定向?_Apache_Http_Https_Apache2_Http Redirect - Fatal编程技术网

如何在内部代理上设置apache HTTP到HTTPS重定向?

如何在内部代理上设置apache HTTP到HTTPS重定向?,apache,http,https,apache2,http-redirect,Apache,Http,Https,Apache2,Http Redirect,在我的网站上,我有两个用Vue编写的应用程序。第一个是端口80上的SPA,第二个是端口8080上的Nuxt SSR,它是从localhost:8000重定向的。 我设法在两个外部端口上都设置了HTTPS,但只有在端口80上HTTP通信被重定向到HTTPS。在端口8080上,HTTPS可以工作,但当我尝试使用http://访问站点时,它会给我Apache错误Bad Requetst: "Your browser sent a request that this server could not u

在我的网站上,我有两个用Vue编写的应用程序。第一个是端口80上的SPA,第二个是端口8080上的Nuxt SSR,它是从localhost:8000重定向的。 我设法在两个外部端口上都设置了HTTPS,但只有在端口80上HTTP通信被重定向到HTTPS。在端口8080上,HTTPS可以工作,但当我尝试使用http://访问站点时,它会给我Apache错误Bad Requetst:

"Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please."
我希望端口8080上的所有流量都重定向到HTTPS

My site.conf:

<VirtualHost *:443>
    ServerName site.com

    SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
    Protocols h2 http/1.1
    SSLEngine On
    SSLCertificateFile cert_path...
    SSLCertificateKeyFile key_path...
    SSLCertificateChainFile cert_path...
    ...
</VirtualHost>

<VirtualHost *:80>
    ...
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    ...
</VirtualHost>

<VirtualHost *:8080>
    ...
    SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
    Protocols h2 http/1.1
    SSLEngine On
    SSLCertificateFile cert_path...
    SSLCertificateKeyFile key_path...
    SSLCertificateChainFile cert_path...

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8000/
    ProxyPassReverse / http://127.0.0.1:8000/

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}:8080/$1 [R,L]
</VirtualHost>

服务器名网站
SSLProtocol all-SSLv3-TLSv1-TLSv1.1
协议h2 http/1.1
斯伦金安
SSLCertificateFile证书路径。。。
SSLCertificateKeyFile密钥路径。。。
SSLCertificateChainFile证书路径。。。
...
...
重新启动发动机
重写cond%{HTTPS}=在…上
重写规则^/?(*)https://%{SERVER_NAME}/$1[R,L]
...
...
SSLProtocol all-SSLv3-TLSv1-TLSv1.1
协议h2 http/1.1
斯伦金安
SSLCertificateFile证书路径。。。
SSLCertificateKeyFile密钥路径。。。
SSLCertificateChainFile证书路径。。。
代理主机
ProxyPass/http://127.0.0.1:8000/
ProxyPassReverse/http://127.0.0.1:8000/
重新启动发动机
重写cond%{HTTPS}=在…上
重写规则^/?(*)https://%{SERVER_NAME}:8080/$1[R,L]