-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
brotli support #3037
Comments
I don't know what exactly you are asking for. |
He appears to be asking for Hapi to support brotli compression in addition to gzip as well as allowing inert to lookup pre-compressed assets created with brotli. Maybe something that could be done in a plugin for the time being? Browser support appears to be nearly non-existent at this point.... |
Sorry for not being clearer. James is correct. Browser support is low, but it is a requirement for WOFF2 web fonts, and as such all browsers will be implementing it in the near future.
|
I'll consider a PR. |
@patrickkettner I will give it a try. I have an initial version (sort of) working and have already pushed the changes to Inert to my fork. Will push the initial hapi changes to my fork next. Consider that I'm just starting with Hapi so my code might require lots of changes. |
@patrickkettner I finished the work to support brotli on hapi. Looks like it works. Can you please check it out? You have to use the following from my fork: hapi (master branch): https://github.com/nrotta/hapijs I have a failing test on inert so I cannot send the PRs yet. I will fix it over the next few days. Thanks |
I'd love to check it out! did you mean https://github.com/nrotta/hapi ? https://github.com/nrotta/hapijs doesn't exist I only ask because nrotta/hapi doesn't contain any brotli commits form what I can see. |
Yes, you are right. Sorry typo. The correct one is: https://github.com/nrotta/hapi Let me know how it goes. |
awesome work! It is not working for me, however. I believe this line has to be modified in order for brotli to be one of the encodings that is possible. or am I screwing something up? |
I did modify that line: https://github.com/nrotta/hapi/blob/brotli/lib/request.js#L119 Try the brotli branch on my fork and let me know how it goes. Btw, it took me a while to get my fork to be installed as a dependency in hapi. Not sure why but the updated code was not being installed. Once you install my hapi fork, you have to change the package.json to point to my fork of inert and subtext. And check the content of node_modules in your hapi install to ensure that the inert & subtext libs have my changes (you can look for 'brotli' on the code base). Thanks |
@nrotta this is probably due to the shrinkwrap |
@nrotta yeah, I found that out. the latest change doesn't work. In this context, it would be |
@AdriVanHoudt you are right. Thanks. @patrickkettner you can set Regarding using |
Chrome and Firefox send
I don't believe any one uses the string
Sure, but no browser sends that header. they send something like the one I used above.
I don't have my laptop on me, but I just From there, I just used the hello world hapi example with a single route (and self signed SSL, since its a requirement for browser usage) |
@patrickkettner you are right. I changed the encoding to 'br' and increased the priority of br over gzip. Please check it out and let me know. |
Now possible via the new server methods |
Quick note that Inert has now been updated with multiple encoding support, and can serve pre-compressed brotli files with my newly published brotli encoder / decoder plugin. |
It would be great to be able to server assets with brotli - especially if I could precompile and serve with
lookupCompressed
. In general it has a much better compression ratio than gzip.The text was updated successfully, but these errors were encountered: