我在将404 http响应重定向到我们的自定义404页面时遇到了一个错误。这种重定向在http(端口80)中有效,但在https(端口443)中无效。
这是我们的网站配置:
LoadModule proxy_module modules/mod_proxy.so
LoadModule ssl_module modules/mod_ssl.so
## SSL config ##
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
###redirect permanent####
Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost _default_:443>
DocumentRoot /var/www/proxyhost/public_html
ErrorLog /var/log/httpd/proxyhost_ssl_error.log
CustomLog /var/log/httpd/proxyhost_ssl_requests.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
ProxyPass /context1/ http://ip:port/context1/
ProxyPass /context2/ http://ip:port//context2/
ErrorDocument 404 /404.html
ErrorDocument 503 /503.html
</VirtualHost>
<Directory /var/www/proxyhost/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
知道为什么https重定向在这里不起作用吗?
谢谢
答案 0 :(得分:0)
已解决:
解决方案:为http和https虚拟主机添加相同的ServerName值