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

http2 returns 403 and "read ECONNRESET" from Googlebot & lynx #29219

Closed
EvHaus opened this issue Aug 20, 2019 · 1 comment
Closed

http2 returns 403 and "read ECONNRESET" from Googlebot & lynx #29219

EvHaus opened this issue Aug 20, 2019 · 1 comment
Labels
http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers.

Comments

@EvHaus
Copy link

EvHaus commented Aug 20, 2019

I'm using the default provided documentation for HTTP2:

const http2Server = http2.createSecureServer({...});

http2Server.on('error', (err) => console.error(err));

http2Server.on('stream', (stream, headers) => {
	stream.respond({
		'content-type': 'text/html',
		':status': 200,
	});
	stream.end('<h1>Hello World</h1>');
});

When I navigate to my server using Chrome, everything works just fine. A Hello World is returned and there are no errors on the server. However, if I try to navigate to my server via lynx myserver.com, my server shows this error:

events.js:177
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:183:27)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}

And the page returns a "HTTP/1.0 403 Forbidden" response, and this message:

Unknown ALPN Protocol, expected `h2` to be available.
If this is a HTTP request: The server was not configured with the `allowHTTP1` option or a listener for the `unknownProtocol` event.

Now sure -- nobody in their right mind would use lynx, but I'm using it to simulate what Googlebot sees -- which is the same 403 error. This means that none of the websites that I create with http2 are indexed by Google. This is a big problem.

Now, if I add {allowHTTP1: true} to my createSecureServer call, the server error goes away and the server doesn't return a 403 anymore -- however, now lynx simply hangs forever on "HTTP request sent, waiting for response".

Any advice would be appreciated.

@EvHaus
Copy link
Author

EvHaus commented Aug 20, 2019

Ok, nevermind. {allowHTTP1: true} was indeed the fix I needed. The slow response was just a weird delay that disappeared when I retried again.

Closing.

@EvHaus EvHaus closed this as completed Aug 20, 2019
@addaleax addaleax added http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers. labels Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

2 participants