简体   繁体   English

Symfony2-HTTPS连接的单独子域

[英]Symfony2 - Separate Subdomain for HTTPS Connections

How do you specify a different subdomain for secure content: ie in the security.yml file I have the following under the access_control: section: 您如何为安全内容指定其他子域:即在security.yml文件中,在access_control:部分下具有以下内容:

- { path: ^/Account/Login, access: isAnonymous(), requires_channel: https }

That's all fine for my development environment, because I have a self-signed wildcard certificate. 这对我的开发环境来说很好,因为我有一个自签名的通配符证书。 In reality in my production environment for this particular website I have an existing SSL certificate that I'd like to use instead of buying another. 实际上,在该特定网站的生产环境中,我有一个现有的SSL证书,我想使用该证书而不是购买另一个证书。

So, say my website is http://www.somesite.com/ and the secure stuff needs to be accessed at https://secure.somesite.com/ ... How do I tell Symfony2 to go to there instead? 因此,假设我的网站是http://www.somesite.com/,并且需要在https://secure.somesite.com/上访问安全内容...我该如何告诉Symfony2转到那里?

Hopefully hostname based routes is a feature that will be available in Symfony 2.2 . 希望基于主机名的路由是Symfony 2.2中可用的功能。 Take a look at this Pull Request . 看一下这个Pull Request

When the time comes you will be able to force HTTPS for different URLS (as you are doing now), and adding hostname requirements for your routes. 时间到了,您将能够对不同的URL强制使用HTTPS (就像现在所做的那样),并为路由添加主机名要求。 Both things combined would let you use a separate subdomain for HTTPS connections. 两者结合起来,将使您可以使用单独的子域进行HTTPS连接。

In the meanwhile, if you cant wait for this feature to come, you can give this blog article a try. 同时,如果您迫不及待想要使用此功能,可以尝试一下此博客文章

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM