Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localhost SSL connection to api ERR_SSL_PROTOCOL_ERROR

I'm trying to connect to an API via Chrome in my dev environment.

I have configured the localhost to run under SSL for testing,

When I connect to the API with https:// I get this error

request.js:132 OPTIONS https://api.thenounproject.com:80/icons/test
net::ERR_SSL_PROTOCOL_ERROR

To get the local dev running on https in Chrome I've had to enable :

chrome://flags/#allow-insecure-localhost. 

Is there anyway around these pesky security issues in development environment?

like image 509
beek Avatar asked Feb 01 '18 21:02

beek


People also ask

How do I fix localhost SSL error?

To fix, try this: go to chrome://net-internals, select “HSTS” from the drop down, enter localhost under “Delete domain” and press the Delete button.

What does error code ERR_SSL_PROTOCOL_ERROR mean?

It is a Secure Sockets Layer (SSL) error that occurs when the browser fails to establish a secure connection with the website. ERR_SSL_PROTOCOL_ERROR may appear because of an issue with the website's SSL certificate or the client's browser.

How do you fix the SSL connection error on Google Chrome?

Update Chrome and your operating system: Sometimes an SSL certificate error can simply be due to using an outdated version of Chrome. To make sure yours is up-to-date, click on the menu. If you have an old version of the browser, you will see an “Update Google Chrome” option.


1 Answers

Old question, and probably you already have an answer, but I'll post it anyway as it is the top hit on google if you look for ERR_SSL_PROTOCOL_ERROR and localhost (with 732 views).

I had this error with NGINX and got ERR_SSL_PROTOCOL_ERROR in google chrome. Googling that error message didn't give me a quick answer. Firefox however throws SSL_ERROR_RX_RECORD_TOO_LONG. Googling that error message led me to this answer on Server Fault and its accepted answer worked for me.

All I had to do was add ssl to the listen line in the server block:

listen 443 ssl;

NGINX documentation also mentions that.

To configure an HTTPS server, the ssl parameter must be enabled on listening sockets in the server block, and the locations of the server certificate and private key files should be specified:

like image 155
axm__ Avatar answered Oct 31 '22 22:10

axm__