OpenSSL::SSL::SSLContext
に OpenSSL::SSL::OP_LEGACY_SERVER_CONNECT
を設定する
#3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Heroku スタックを v24 にアップグレードしたところ、OpenSSL のバージョンが 1.1 から 3系に上がった。OpenSSL 3.0では、一部のレガシーなTLS再ネゴシエーションがデフォルトで無効化されたため、HTTP の HEADリクエストで、
SSL_connect returned=1 errno=0 peeraddr=210.160.220.115:443 state=error: unsafe legacy renegotiation disabled
のエラーが出るようになった。そこで、OpenSSL 3.0 の制約を回避するために
OpenSSL::SSL::SSLContext
にOpenSSL::SSL::OP_LEGACY_SERVER_CONNECT
を設定することで、古い TLS 設定のサーバーとも通信できるようにする。本来であれば、今回エラー対象となったショップサーブのサーバーのTLS設定を変更してもらうのが良いが、いつ解消されるかわからないため、一時的な対応としてレガシーなTLS通信を許容する。
How to review it
Merge condition
Note