LoginSignup
12
11

More than 5 years have passed since last update.

nginxでのリバースプロキシーと505エラー

Posted at

フロントへはhttp通信、バックへはhttps通信をするようなリバースプロキシー環境で数時間ハマったので備忘録として記載する。

このような環境でクライアントからnginxにアクセスすると何故かHTTP Statusが505 Errorとなった。こんな構成は制約がなければしませんが。。。

# curl -I http://<リバースプロキシーホスト名>/
HTTP/1.1 505 HTTP Version Not Supported
Server: nginx/1.6.0
Date: Wed, 13 Aug 2014 02:34:01 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive

proxy-backend間の通信が原因かなと公式サイトを読んでいると、proxy-backend間の通信はHTTP/1.0が使用されるような記載があった。
内容的にはbackendへのkeepalive有効にする場合はHTTP/1.1を使えというもの。リンク先
設定で明示的に変更できるようなので下記を追加する。

location / {
    proxy_http_version 1.1;

nginxを再起動してリトライ

# curl -I http://<リバースプロキシーホスト名>/
HTTP/1.1 404 Not Found
Server: nginx/1.6.1
Date: Thu, 14 Aug 2014 01:17:28 GMT
Content-Type: text/plain
Connection: keep-alive
Strict-Transport-Security: max-age=2592000
X-Content-Type-Options: nosniff

nginxのリバースプロキシーで505エラーとなった際はお試しあれ。

12
11
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
12
11