symfony 3 在强制https时重定向太多
我有一个问题,类似于SO上发布的其他问题,但这些解决方案都没有奏效。
我使用的是OSX El Capitan Server内置的Apache,当我不通过以下指令将http流量强加到https上时,https可以正常工作:
access_control:
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https, host: mypc\.local$ }
但是,添加此内容会导致在访问我的网站的本地uri时出现“重定向过多”错误:https://mypc.local/myproject/web/
满:security.yml
security:
access_control:
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https, host: mypc\.local$ }
providers:
our_db_provider:
entity:
class: AppBundle:Users
property: username
encoders:
AppBundle\Entity\Users: plaintext
firewalls:
# disable authentication for assets and the profiler
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
http_basic: ~
provider: our_db_provider
anonymous: ~
form_login:
login_path: /
check_path: login
logout:
path: /logout
target: /
invalidate_session: true
编辑:这是响应标头:
> GET /myproject/web/ HTTP/1.1
> Host: mypc.local
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 09 Aug 2016 12:15:00 GMT
< Server: Apache
< X-Powered-By: PHP/5.5.31
< Cache-Control: no-cache
< Location: https://mypc.local/myproject/web/
< MS-Author-Via: DAV
< Content-Length: 396
< Content-Type: text/html; charset=UTF-8
<
* Ignoring the response-body
* Connection #0 to host mypc.local left intact
* Issue another request to this URL: 'https://mypc.local/myproject/web/'
* Found bundle for host mypc.local: 0x7f89b2d01780
* Re-using existing connection! (#0) with host mypc.local
* Connected to mypc.local (fe80::ea06:88ff:fecf:61c6) port 443 (#0)
> GET /myproject/web/ HTTP/1.1
.... repeated 20 times