在 SilverStripe 3.1.x 中 - 是否有用于设置安全 baseURL 的选项?
在 mysite/_config.php 中,我有以下内容:
Director::forceSSL(array('/^admin/', '/^Security/'));
当访问包含“admin”或“Security”的 URL 时,SilverStripe 使用 https,这对于为其域购买了安全证书的人来说非常有用。但是,对于那些在共享托管平台上使用共享 SSL 的人来说,站点的基本安全 URL 可能完全不同。
因此,虽然不安全的基本 URL 可能是
http://www.example.com/
,
安全基础 URL 可能是 https://123.45.67.89/example.com/
我如何为“admin”和“Security”强制使用 SSL 并指定基本安全 URL,这是某些主机在使用基本共享 SSL 证书时所需要的?
最佳答案
你不能为此使用 URLRewriting
吗?任何 HTTPS 请求都被重定向到正确的域...
以 Apache 为例,取自 https://github.com/h5bp/server-configs-apache
# Rewrite secure requests properly in order to prevent SSL certificate warnings.
# E.g.: prevent `https://www.example.com` when your certificate only allows
# `https://secure.example.com`.
# <IfModule mod_rewrite.c>
# RewriteCond %{SERVER_PORT} !^443
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
# </IfModule>
关于security - SilverStripe 3.1.x https - 是否有用于为共享 SSL 设置安全基本 URL 的配置选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24268246/