Symfony2:如何强制整个应用程序的HTTPS?

是否可以强制https用于整个应用程序,而无需为所有100个路由/防火墙规则定义它?

我们试图在网络服务器级别强制https,但symfony2仍然尝试重定向到http并生成一些奇怪的链接(http:// […]:443).

我阅读了配置文档,但没有找到任何相关内容.所有食谱条目也仅用于按路径/安全规则启用它.

最佳答案
How to force HTTPS or HTTP for Different URLs

The Security component provides a way to enforce HTTPs via the
requires_channel setting. This alternative method is better suited
to secure an “area” of your website (all URLs under /admin) or when
you want to secure URLs defined in a third party bundle.

access_control:
    - path: ^/secure
      roles: ROLE_ADMIN
      requires_channel: https

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...