0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWSでWordPressをSSL化した際にリダイレクトループを回避する方法

Posted at

AWSでWordPressをSSL化したらアクセスできなくなった場合の対処法。

chrome
このページは動作していません
mercari.meta-think.net でリダイレクトが繰り返し行われました。
Cookie を消去してみてください.
ERR_TOO_MANY_REDIRECTS
180805_12.jpg

原因は、ロードバランサーまでの通信がSSLで、EC2までの通信が80番なため、http → https への302リダイレクトループが発生してしまうため。
wp-config.php に以下を追記すればOK。

DocumentRoot/wp-config.php
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
       $_SERVER['HTTPS']='on';
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?