LoginSignup
12
8

More than 5 years have passed since last update.

サーバへのリクエストをProxyPassでS3に流すときに502エラー

Posted at

WebサーバにきたリクエストをS3に流そうとおもって設定をかけたところ

ProxyPass /hoge http://xxxxxx.s3-ap-northeast-1.amazonaws.com/hoge
ProxyPassReverse /hoge http://xxxxxx.s3-ap-northeast-1.amazonaws.com/hoge

error_logに時々こんなエラーが出て、502エラーで返してしまう
(全リクエストの3%くらい)

[Thu Apr 01 00:00:00 2014] [error] [client xxx.xxx.xxx.xxx] (20014)Internal error: proxy: error reading status line from remote server xxxxxx.s3-ap-northeast-1.amazonaws.com
[Thu Apr 01 00:00:00 2014] [error] [client xxx.xxx.xxx.xxx] proxy: Error reading from remote server returned by /hoge

この辺りを見ながら、proxy-initial-not-pooled を有効にすればよさそうと判断
http://lasecwww.epfl.ch/manual/ja/mod/mod_proxy_http.html
http://ttaka.dip.jp/maniax/?ReverseProxy%E3%81%AE%E8%A8%AD%E5%AE%9A

設定を以下のように修正し、502エラーが発生しなくなりました

SetEnv proxy-initial-not-pooled 1

ProxyPass /hoge http://xxxxxx.s3-ap-northeast-1.amazonaws.com/hoge
ProxyPassReverse /hoge http://xxxxxx.s3-ap-northeast-1.amazonaws.com/hoge
12
8
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
8