Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

openssl error #3560

Closed
DaisyDogs07 opened this issue Oct 3, 2021 · 2 comments
Closed

openssl error #3560

DaisyDogs07 opened this issue Oct 3, 2021 · 2 comments

Comments

@DaisyDogs07
Copy link

DaisyDogs07 commented Oct 3, 2021

Version

10.0.0 - 17.0.0

Platform

Linux 46aea4d126eb 5.11.0-1020-gcp #22~20.04.1-Ubuntu SMP Tue Sep 21 10:54:26 UTC 2021 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

create an https server, listen, And request the server
reproducible code:

require('https').createServer()
  .on('request', (req, res) => {
    return res.writeHead(200).end();
  })
  .on('clientError', e => console.log(e))
  .listen(3000);

How often does it reproduce? Is there a required condition?

every time

What is the expected behavior?

emit the request event, respond accordingly, and move on

What do you see instead?

an openssl error from the 'clientError' event

[Error: C0C70EF8F77F0000:error:0A00009C:SSL routines:ssl3_get_record:http request:../deps/openssl/openssl/ssl/record/ssl3_record.c:345:
] {
  library: 'SSL routines',
  reason: 'http request',
  code: 'ERR_SSL_HTTP_REQUEST'
}

Additional information

No response

@mscdex mscdex transferred this issue from nodejs/node Oct 4, 2021
@tniessen
Copy link
Member

tniessen commented Jan 4, 2022

This error occurs when the client makes a plain HTTP request instead of an HTTPS (HTTP over SSL/TLS) request. In other words, Node.js aborts the connection because the client is not using SSL/TLS for the request, i.e., is using http://localhost:3000/ instead of https://localhost:3000/.

To accept HTTPS requests, you will need to supply a certificate to createServer.

@marsonya
Copy link
Member

marsonya commented Apr 1, 2022

Hope the answer was helpful.
A workaround/resolution has been provided so I am closing this issue.
Please feel free to reopen this issue if there is more to be added.

@marsonya marsonya closed this as completed Apr 1, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants