Details
-
Bug
-
Resolution: Fixed
-
High
-
3.3.0
Description
It's not possible to configure trusted proxies using an environmental variable.
Setup:
Project configured to use Varnish, Varnish running in the background
Steps to reproduce:
1. Set up project to use Varnish token invalidation:
export HTTPCACHE_VARNISH_INVALIDATE_TOKEN=testToken
2. Set up trusted proxies in your server configuration, example for Apache:
SetEnv TRUSTED_PROXIES 127.0.0.1,192.168.33.16,192.168.0.122
3. Clear Varnish cache running
php bin/console fos:httpcache:invalidate:tag ez-all -vv
Expected:
Cache is cleared
Actual:
08:11:10 CRITICAL [app] 401 error response "Unauthorized" from caching proxy ["exception" => FOS\HttpCache\Exception\ProxyResponseException^ { …}] In HttpDispatcher.php line 138: [FOS\HttpCache\Exception\ExceptionCollection] 401 error response "Unauthorized" from caching proxy
In previous versions we had this code setting up trusted proxies:
https://github.com/ezsystems/ezplatform/blob/master/public/index.php#L16-L22
this seems to be missing when installation is done from flex.
The 401 code seems to be coming from https://github.com/ezsystems/ezplatform-http-cache/blob/master/src/Controller/InvalidateTokenController.php#L59-L63