1084

Site behind nginx with Let's Encrypt.

Comments for “Site behind nginx with Let's Encrypt.”
 

Posted by JOhn Mold on Thursday 30th May 2024 at 19:45 GMT

Hi all,
I am hosting my own website and it is behind nginx proxy manager and using Let's Encrypt. The custom routing was not working and some of the Manage Articles features were acting weird, like uploading pictures was broken, and some other stuff.
After a lot of bug tracking and testing new things inside the engine folder, I narrowed it down to the current_url function inside the url_helper. The $_SERVER['HTTPS'] was not set to on so it was returning the wrong url. Adding $_SERVER['HTTPS'] = 'on'; to config.php seems to have fixed most of my problems, if not all.
Does anybody see any problems doing this?? What would be other solutions to this problem??
Thank you,
John
Level One Member

JOhn Mold

User Level: Level One Member

Date Joined: 13/10/2023

Posted by ak1 on Friday 31st May 2024 at 04:55 GMT

Hi John,

Interesting find. I don't see anything wrong with your solution, but for some other ideas, check out this Serverfault answer:

https://serverfault.com/questions/875245/nginx-how-to-enable-ssl-for-php-when-behind-a-reverse-proxy

From a PHP standpoint, they discuss looking at $_SERVER['HTTP_X_FORWARDED_PROTO'], which should have a value of 'https' if indeed the traffic originated over HTTPS.

Another option discussed is to configure Nginx to pass that information along to PHP/whatever is next in the chain behind the proxy.

Hope this helps,

A.K.
Level One Member

ak1

User Level: Level One Member

Date Joined: 16/01/2023

×