# Server looks for $\_SERVER\['HTTPS'\]

**URL:** <https://community.localwp.com/t/server-looks-for-server-https/5256>\
**Category:** Support\
**Created:** [February 15, 2018, 2:49am UTC](https://community.localwp.com/t/server-looks-for-server-https/5256 "2018-02-15T02:49:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keith](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@Keith](https://community.localwp.com/u/Keith)\
**Post date:** [February 15, 2018, 2:49am UTC](https://community.localwp.com/t/server-looks-for-server-https/5256/1 "2018-02-15T02:49:53Z")

</div>

Some php code expects to find $\_SERVER[‘HTTPS’] == ‘on’ when served via ssl.

The current LbF setup uses nginx to route both http and https to apache on port 80, and neither makes any effort to set ‘HTTPS’.

Editing /conf/sites-enabled/000-default.conf to include the following solves the problem.

```
 # This is to forward all PHP to php-fpm.
 <IfModule mod_proxy_fcgi.c>
      #set $_SERVER['HTTPS']
      <IfModule mod_setenvif.c>
	SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
	SetEnvIf X-Forwarded-Proto "^http$" HTTPS=off
  </IfModule>
 ...
```

---

<div class="post-metadata">

**Author:** ![Alberto](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/alberto/32/2790_2.png) [@Alberto](https://community.localwp.com/u/Alberto)\
**Post date:** [May 28, 2018, 3:31am UTC](https://community.localwp.com/t/server-looks-for-server-https/5256/2 "2018-05-28T03:31:26Z")

</div>

Thanks for sharing, this actually helped me solve an issue where I was getting a ‘too many redirects’ error on a non-WordPress software package. I added that snipped to my .htaccess and that fixed it.

Question for Local dev team, would it be possible to add that snippet in an upcoming release? This might alleviate many of the redirect issues people are reporting and avoid overall confusion for those of us using php applications that rely on this.

---

<div class="post-metadata">

**Author:** ![Keith](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@Keith](https://community.localwp.com/u/Keith)\
**Post date:** [July 30, 2018, 6:32pm UTC](https://community.localwp.com/t/server-looks-for-server-https/5256/3 "2018-07-30T18:32:26Z")

</div>

Version 2.3.2 lists this in its release notes

- Fix: HTTPS status is properly sent to PHP-FPM to eliminate the need to inject a small block of code into wp-config.php

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [August 25, 2020, 6:33pm UTC](https://community.localwp.com/t/server-looks-for-server-https/5256/4 "2020-08-25T18:33:51Z")

</div>

Closed on August 25, 2020, 6:33pm UTC


