简体   繁体   English

如何强制Rails仅使用SSL上的TLS?

[英]How can I force Rails to only use TLS over SSL?

We are being forced to only use TLS instead of SSL when sending a request to a server, but we don't know how to make sure that the request is being sent using TLS, and if it's not, we're not sure how to force Rails to do it. 我们被迫在向服务器发送请求时仅使用TLS而不是SSL,但我们不知道如何确保使用TLS发送请求,如果不是,我们不确定如何强迫Rails做到这一点。

Here is how we are sending the request: 以下是我们发送请求的方式:

uri = URI.parse("https://someurl.com")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(uri.path)
request.body = body
http.request(request)

尝试添加

http.ssl_options = OpenSSL::SSL::OP_NO_SSLv2 + OpenSSL::SSL::OP_NO_SSLv3 + OpenSSL::SSL::OP_NO_COMPRESSION

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM