Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#concrete5 #5.7 How to work concrete5 behind a load balancer or a reverse proxy
<?php
/**
* Always trust incoming request.
*
* application/config/concrete.php
*
* For more detail, see: http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html
*/
// Get remote address
$remoteIp = $_SERVER['REMOTE_ADDR'];
return [
'security' => [
'trusted_proxies' => [
'ips' => [$remoteIp]
],
],
];
@typoman76

This comment has been minimized.

Copy link

typoman76 commented Jun 7, 2018

Is this still valid for concrete5 8.x?

@xtedx

This comment has been minimized.

Copy link

xtedx commented Oct 5, 2018

Is this still valid for concrete5 8.x?

yes, i just tried it on concrete5 8.4 running on nginx 1.10.3 and works as expected. no more session expired issues.

@KorvinSzanto

This comment has been minimized.

Copy link

KorvinSzanto commented Aug 30, 2019

This gist can be dangerous! It's far better to configure the actual IPs you expect to proxy your connections rather than just allowing anyone to proxy you.

@hissy

This comment has been minimized.

Copy link
Owner Author

hissy commented Sep 2, 2019

Yes, this gist can be dangerous. Please read the Symfony doc in the comment.

Some reverse proxies (like AWS Elastic Load Balancing) don't have a static IP address or even a range that you can target with the CIDR notation. In this case, you'll need to - very carefully - trust all proxies.
Configure your web server(s) to not respond to traffic from any clients other than your load balancers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.