In Symfony, how can I require http in a dev environment and https in production?

六月ゝ 毕业季﹏ 提交于 2019-12-12 08:59:03

问题


In production, I have a group of routes that require SSL however this shouldn't be a requirement for development.

I thought that I could simply override my routes in routing_dev.yml but that doesn't seem to work. When navigating to any route, it forces https.

My Setup:

  • app/config/routing_dev.yml contains a series of routes, duplicated from src/FOO/FOOBarBundle/Resources/config/routing, without schemes: [https]
  • src/FOO/FOOBarBundle/Resources/config/routing.yml contains the same as above just with schemes: [https]

I expected that the routes in routing_dev.yml would have preceded those in the bundle and would have been the ones used while in development.

Am I on the right path, or is there a better way of accomplishing http in development and https in production for a select group of routes?


回答1:


You need to use src/FOO/FOOBarBundle/Resources/config/routing_dev.yml for dev-environment (import it in app/config/routing_dev.yml instead of importing src/FOO/FOOBarBundle/Resources/config/routing.yml)



来源:https://stackoverflow.com/questions/16971030/in-symfony-how-can-i-require-http-in-a-dev-environment-and-https-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!