-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSSL::SSL::SSLError: hostname "XYZ" does not match the server certificate #8
Comments
Do you proxy in this fashion:
|
Hi Alex, thanks for the reply! I'm redirecting my /blog to a wordpress blog hosted on a subdomain at flywheelsites. The admins at flywheel installed my matching SSL certificate. When I run
and
The certs seem to match. Here's my code: config.ru use Rack::ReverseProxy do
reverse_proxy /^\/blog(\/.*)$/, 'https://XYZ.flywheelsites.com$1', :preserve_host => true
end In my routes, I also have: get "/blog" => redirect("https://www.XYZ.com/blog/") |
can you try to make a request with curl in verbose mode and paste the output in gist? |
This is the response for /blog:
And here is the output for /blog/
|
Ok. That means that this error occurs when your proxy app (heroku) tries to connect to your blog app, which sits on HTTPS. I assume that some header (like ORIGIN or something else, that contains host of your proxy app) gets passed in request that makes ssl library to reject certificates. Have you tried to set |
I just push the code with :preserve_host => false and same problem. I've reached out to the blog hosting company to see if it is something on their end. Any other way to debug and see what is going on under the hood? Really appreciate your help, thanks! |
It can be a problem with reverse proxying concept. I always got ssl errors with https => https proxying, even on standard reverse proxies, like NGINX. With nginx what you usually do is https => http server directly. So there is a chance, that this error is expected.. |
FYI, I came across this same problem and thought I'd make the solution a bit clearer. In this code above:
You need to make sure the Flywheel website is
Then, it should work as expected. |
Just to link this here, with PR #24, it is possible to disable https certificate validation altogether. |
@MrMarvin I have released |
Thank you @justinkuepper! Your solution works for me! |
Hi,
I'm having issues trying to use rack-reverse-proxy to host a wordpress blog from another site on my heroku domain. I'm using puma server and when I try to go to https://mydomain.com/blog I get the following error:
OpenSSL::SSL::SSLError: hostname "XYZ" does not match the server certificate
Everything seems to work fine if I don't use SSL. I have verified that the certificates on my wordpress blog and heroku site match (other than the wordpress blog has a different hostname I guess), but can't figure out how to resolve this. Any help is much appreciated.
Very helpful gem btw.
Thanks! Aaron
The text was updated successfully, but these errors were encountered: