Commit 4b1ae82b authored by Rob's avatar Rob Committed by Fabien Potencier

Update http_cache.rst - hint at whitelisting 127.0.0.1 if using HTTP Cache solution

parent 70b55dc3
......@@ -54,17 +54,28 @@ setting Response HTTP cache headers::
.. tip::
If you want Silex to trust the ``X-Forwarded-For*`` headers from your
reverse proxy at address $ip, you will need to run your application like
this::
reverse proxy at address $ip, you will need to whitelist it as documented
in `Trusting Proxies
<http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html>`_.
use Symfony\Component\HttpFoundation\Request;
If you would be running Varnish in front of your application on the same machine:
.. code-block:: php
Request::setTrustedProxies(array($ip));
use Symfony\Component\HttpFoundation\Request;
Request::setTrustedProxies(array('127.0.0.1', '::1'));
$app->run();
This provider allows you to use the Symfony2 reverse proxy natively with
Silex applications by using the ``http_cache`` service::
Silex applications by using the ``http_cache`` service. The Symfony2 reverse proxy
acts much like any other proxy would, so you will want to whitelist it:
.. code-block:: php
use Symfony\Component\HttpFoundation\Request;
Request::setTrustedProxies(array('127.0.0.1'));
$app['http_cache']->run();
The provider also provides ESI support::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment