I'm using the Bluepay API to process payments in my Rails app. The following code is setting up a POST request to the server. RootCA
is the path to the SSL certs; locally this is just set to '/'
ua = Net::HTTP.new(SERVER, 443)
ua.use_ssl = true
# Checks presence of CA certificate
if File.directory?(RootCA)
ua.ca_path = RootCA
ua.verify_mode = OpenSSL::SSL::VERIFY_PEER
else
puts "Invalid CA certificates directory. Exiting..."
exit
end
This works fine locally after calling ua.post(<args>)
. On Heroku however, the following error is returned:
400 Bad Request
The plain HTTP request was sent to HTTPS port
I have set the SSL certificate path to "/usr/lib/ssl/certs/" as instructed in this Quora answer, but I'm still getting an error.