Commit a793aa89 authored by Fabien Potencier's avatar Fabien Potencier

minor #874 Update http_cache.rst - hint at whitelisting 127.0.0.1 if using...

minor #874 Update http_cache.rst - hint at whitelisting 127.0.0.1 if using HTTP Cache solution (alcohol)

This PR was squashed before being merged into the 1.2.x-dev branch (closes #874).

Discussion
----------

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

Took me quite a while to realise this; this simple tip might help others save that time :-)

Commits
-------

4b1ae82b Update http_cache.rst - hint at whitelisting 127.0.0.1 if using HTTP Cache solution
parents 0be92fa8 4b1ae82b
......@@ -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