Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Help @Step-Basic-Readme #927

Closed
XBelenus opened this issue Nov 29, 2017 · 6 comments
Closed

Help @Step-Basic-Readme #927

XBelenus opened this issue Nov 29, 2017 · 6 comments

Comments

@XBelenus
Copy link

Hello,
this question seems so dumb but i can't figure it out, after generating my new app, where do i configure feathers to be be served over http2.createServer();

@eddyystop
Copy link
Contributor

@daffl ^^^

@XBelenus
Copy link
Author

i founded a way by following the https section mixed with Node's http2 example but i cannot see my index.html file, i receive a:

  • "ERR_SSL_PROTOCOL_ERROR" when browsing to https://localhost:3030
  • "ERR_INVALID_HTTP_RESPONSE" when browsing to http://localhost:3030
    i have tried to listen port 443 too but the same happened.
    Otherwise when i use https instead, every things works fine. i can access the file throught https.
    i modified the /src/index.js file as follow:

`/* eslint-disable no-console */
const logger = require('winston');
const app = require('./app');
const port = app.get('port');
const fs = require('fs');
var http2 = require('http2');
const server = http2.createServer({
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
}, app).listen(port);

process.on('unhandledRejection', (reason, p) =>
logger.error('Unhandled Rejection at: Promise ', p, reason)
);

server.on('listening', () =>
logger.info('Feathers application started on http://%s:%d', app.get('host'), port)
);

server.on('stream', (stream, headers)=>{
stream.respond({
'content-type': 'text/html',
':status': 200
});
stream.respondWithFile(app.get('public')+'index.html',{
'content-type': 'text/plain'
});
stream.end();
})`

@eddyystop
Copy link
Contributor

PM daffl on Slack to look at this issue. I'll be interested in knowing the result of any discussion.

@daffl
Copy link
Member

daffl commented Nov 29, 2017

HTTP2 support is being tracked in feathersjs/feathers#369. I don't believe Express officially has it yet but as with everything related to Feathers and HTTP, everything that works with Express will work as well.

Once Buzzard is out we will also look into adding transport providers that use the Node HTTP/HTTP2 modules directly.

@corymsmith
Copy link
Contributor

The issue you are seeing is probably because HTTP2 requires SSL encryption and I think most browsers only support HTTP2 over SSL

@XBelenus
Copy link
Author

It works fine with the SPDY implementation for Express, i just replaced "require('http2')" with "require('spdy')" and it works fine now! i will also look at KoaJS it support http2 native module and is written by the Express team.
h2spdy
Thank you again FeathersJS is amazing !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants