Skip to content
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

Proxy error when connecting to API backends that reject non-SNI requests #357

Closed
GUI opened this issue Oct 19, 2016 · 1 comment
Closed

Comments

@GUI
Copy link
Member

GUI commented Oct 19, 2016

If an API backend requires SNI for establishing an SSL connection, then api.data.gov currently returns a 502 Bad Gateway error when trying to access the API. This doesn't appear to affect most servers, since nginx and Apache appear to always return at least some default certificate, even when SNI isn't present. However, today we ran into this issue since a backend server doesn't complete the SSL handshake when SNI isn't present:

$ openssl s_client -connect discovery.gsa.gov:443
CONNECTED(00000003)
140735288418384:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:769:

---
no peer certificate available

---

You can also see that the connection is closed when making a request directly to the IP:

$ curl "https://$(dig +short discovery.gsa.gov | head -n 1)"
curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

At first I thought this might be related to how we resolve the DNS for API backends, but luckily the issue is more straightforward. nginx simply does not enable SNI when establishing connections to backend servers by default. Luckily, there's a couple of configuration options we can use to easily control this (proxy_ssl_server_name and proxy_ssl_name).

GUI added a commit to NREL/api-umbrella that referenced this issue Oct 19, 2016
@GUI
Copy link
Member Author

GUI commented Oct 19, 2016

Fixed by NREL/api-umbrella@139ea9e We've added this specific type of SSL & SNI setup to our test suite.

@GUI GUI closed this as completed Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant