LoginSignup
1
1

More than 5 years have passed since last update.

「Jenkins says my reverse proxy setup is broken」でもう一つ確認すべき場所

Posted at

結論: システム設定にあるJenkins URLが正しいかを確認しよう。

どうでも良い詳細

ProxyPass         /jenkins  http://localhost:8042/jenkins nocanon
ProxyPassReverse  /jenkins  http://localhost:8042/jenkins
ProxyRequests     Off
AllowEncodedSlashes NoDecode

# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
<Proxy http://localhost:8042/jenkins>
  Order deny,allow
  Allow from all
</Proxy>

大体こういう感じの設定で問題ないはずなんだけど、それでもうまくいかないという不思議状況が発生した。

本家のドキュメント (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+says+my+reverse+proxy+setup+is+broken) に従ってcurlコマンドを実行してみる。

$ curl -iL -e http://example.com/jenkins/manage http://example.com/jenkins/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test

これでも最終的に404が出る。ところが http://example.com:8080/jenkins/admin... となるべきところが何故か http://example.com:8080/admin... となる。へ??

リバースプロキシさせているApacheではなくJettyに直接curlを投げ込んでみた。

$ curl -iL http://example.com:8080/jenkins/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test

ここで何故か、Jettyが

にRedirect (304 Found) し、(/jenkins プレフィクスがないので) ここで404となる。

デバッグのため、試しに/etc/default/jenkinsと/etc/apache2/sites-enabled/...の双方のポート番号を変えてみたところ、それでも8080番ポートの誤ったURLに飛ぶ。再起動しても同じ。(゚Д゚)ハァ?

ここまで来ると流石に別の場所に「8080」という文字列を含む別の永続ストレージに設定が残っていると考えざるをえない。

で、Jenkinsのシステム設定を見たら、多分自分で設定したんだがJenkins URLにhttp://example.com:8080 とあった。これをhttp://example.com/jenkins に変えたら症状は落ち着いた。「my reverse proxy setup is broken」とも言われなくなった。

1
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
1
1