-
Notifications
You must be signed in to change notification settings - Fork 757
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
Support for node native HTTP2 module #1517
Comments
@henryoliver yes I'd like to implement http2 by default, but there were issues implementing response modifications and other vital features that Browsersync uses. it could be the case that this is no longer a problem, so I will address this asap 👍 |
Thank you @shakyShane ! I'm a fan of BrowserSync and had been using it in many projects. Great job guys! |
@shakyShane just checking, any update on the http2 implementation? Thanks! |
I have a few questions about this:
EDIT: code below updated to use browserify's implementation of const requireResolve = require('resolve');
// get molnarg's http2 module
const http2Module = require(requireResolve.sync('http2', { basedir: process.cwd() }));
bsync.init({
/*...other options...*/
httpModule: http2Module,
https: true,
}, cb); |
@shakyShane any news on Node's built-in HTTP2 support? The LTS release v10 is out so it's not in experimental mode anymore. |
I'd like to point out as I implied in my comment above: the native As of—at latest—Node 9.x, The workaround is to use the // Node v 9.x+
const resolve = require('resolve');
resolve.sync('http2') // will resolve the molnarg http2 module if you have it installed
require.resolve('http2') // will always resolve the native http2 module |
I am trying to get browsersync to load in http2.0. Browser sync runs with no issues, but I when I try to access the app:
I don't have this issue with https and http 1, only http 2 and https. Anyone know what is wrong?
|
I'm not sure if you can use http2/https with a proxying setup 🤷♂ |
@lunelson Thank you for the reply. I also ran it without the proxy at but still hitting the issue. I am wondering if it has to do with the browsersync version? Maybe some kind of regression in the 2.26.7? Do you know of a version that works for sure with http2? |
I'm using |
We have the same issue as @dman777 w/ |
@lunelson - did you get anywhere with this? I'm having the same issue with v2.27.5 on node 10. Documentation suggests everything works with:
but it just doesn't work. Tried 'requiring in' http2 as per @dman777 suggestion above but no joy. Not running as a proxy, browserSync is hosting. Super frustrating. |
I struggled with this too. I think the problem might be that browser-sync doesn't really support https with http2. In browser-sync/packages/browser-sync/lib/server/utils.js Lines 104 to 125 in 764a437
Both of these modules have a browser-sync/packages/browser-sync/lib/server/utils.js Lines 82 to 103 in 764a437
But there isn't a separate module module for 'http2s'; the native I hacked-around this via: const http2 = require('http2');
http2.createServer = http2.createSecureServer; which got http2 working in browser-sync (along with the aforementioned config options: https: true,
httpModule: 'http2', ) |
@jfstephe it's been a long time since I used this but back then the solutions I outlined above did work: the non-native http2 module was compatible with BS, the trick was getting that one instead of the native one, since they had the same name |
Interesting... is there a way to get the non native http2 module? |
@lunelson thanks for responding. I had missed the 'molnarg http2' bit in your comment above (doh!). I've got that installed now but still no joy. I can't see that it's loading that module. Seems to just be using the default. PS I'm actually running on node 10, in case that affects anything?! |
@jfstephe my solution from back then probably depends on the specific versions of the |
Issue details
Please update browser-sync so it no longer seeks for a third-party node module when you set
httpModule: 'http2'
, but instead uses the node native one.Please specify which version of Browsersync, node and npm you're running
Affected platforms
Browsersync use-case
If CLI, please paste the entire command below
node ./.tasks/browsersync.js
for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync
The text was updated successfully, but these errors were encountered: