Context: I have a Cloudfoundry app running on Ruby 3.0. I'm using a forward proxy to access an external API and that proxy is going away soon so I have to switch to a new service. Problem: When I switch I receive a 404 error.
The new proxy admin says he doesn't see anything coming when I get the 404 error. When I use curl, I can access the URL through the new proxy and the admin can see it.
I was using Net::http on ruby 2.x, I upgraded to ruby 3.0 and moved to httpclient, then Faraday, same issue.
error: /home/vcap/deps/0/vendor_bundle/ruby/3.2.0/gems/net-http-0.6.0/lib/net/http/response.rb:277:in `error!': 404 "Not Found" (Faraday::ConnectionFailed)
Right now my tests consist of a simple GET on https://www.google.com because th eresult is the same, http 404.
@proxi = {
uri: "#{get_config.proxy.protocol}://#{get_config.proxy.hostname}:#{get_config.proxy.port}",
user: "#{get_config.proxy.username}",
password: "#{get_config.proxy.password}"
}
conn = Faraday.new(
proxy: @proxi
) do |faraday|
faraday.response :logger, ::Logger.new(STDOUT), { headers: true, bodies: true, errors: true }
faraday.adapter Faraday.default_adapter
end
response = conn.get("https://www.google.com") do |req|
req.headers['Content-Type'] = 'application/json'
end
Proxy object is correct, and the values are taken from the environment where I run the app, the same parameters that work with curl. The only difference I see between the old and the new proxy is that the url is using https signed with an internal certificate. But if I had a handshake issue I guess I would have a different error?
I'm not sure where to get from there. Any idea?
uriyou are proxying through but maybe try hard coding it? "if I had a handshake issue I guess I would have a different error?" its not a handshake issue, it could simply be that you are accessing port 80 which 404s when you should be using 443 or vise versa. Hard coding the protocol and port will allow you to check this off the list and change the config if needed.