Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index HTTP_X_FORWARDED #2562

Closed
blindpet opened this issue Mar 13, 2016 · 3 comments
Closed

Undefined index HTTP_X_FORWARDED #2562

blindpet opened this issue Mar 13, 2016 · 3 comments

Comments

@blindpet
Copy link

@blindpet blindpet commented Mar 13, 2016

I require the lines in wp-config.php for SSL termination, wp cli complains about them

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
        $_SERVER['HTTPS']='on';

This is the error thrown by wp cli when I run it in the root of the WP installation

Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/bin/wp/php/WP_CLI/Runner.php(756) : eval()'d code on line 57

I still seem to be able to install plugins but that's all I've tried so far

@danielbachhuber

This comment has been minimized.

Copy link
Member

@danielbachhuber danielbachhuber commented Mar 13, 2016

I require the lines in wp-config.php for SSL termination, wp cli complains about them

$_SERVER isn't populated in the CLI context. You'll need to check if the index is set:

if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
        $_SERVER['HTTPS']='on';
@JOduMonT

This comment has been minimized.

Copy link

@JOduMonT JOduMonT commented Jul 11, 2019

why after almost 4 years it still an issue without any proper solution ?
why we still need to tweak wp-config.php and it didn't became a standard parameter into it ?

and even with the solution mentioned by @danielbachhuber it still not working for me
...

@wgroenewold

This comment has been minimized.

Copy link

@wgroenewold wgroenewold commented Jul 11, 2019

I'm using this snippet @JDmnT , did you do the define as well?

https://gist.github.com/wgroenewold/68fcaaabfbf939282b1a5cddd6f636e8

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