revoltchat / self-hosted

Deploy Revolt using Docker.
854 stars 108 forks source link

Make GZIP/BROTLI compression of 'sirv' configurable #27

Closed kuhnchris closed 2 years ago

kuhnchris commented 2 years ago

Hi, after trying to initially setup a Revolt instance I kind of failed to realize that my reverse proxy (traefik) has issues with the pre-configured gzip and brotli compression of the sirv server used by the "web" container.

I had to go into the container and modify the package.json script to

        "start:inject": "node scripts/inject.js && sirv dist_injected --cors --single --host -G false -B false"        

as the default setting of sirv is to activate GZip and Brotli compression (i.e. adding -G false and -B false)

    -G, --gzip         Send precompiled "*.gz" files when "gzip" is supported  (default true)                                                                                 
    -B, --brotli       Send precompiled "*.br" files when "brotli" is supported  (default true)        

So adding a setting in the .env file would enable us to disable the gzip and brotli compression and have revolt usable via a reverse proxy.

Maybe I overlooked something in the documentation?

Thanks!

Aethrexal commented 2 years ago

Doesn't seem it's just your reverse proxy. I've been having issue running the quick start on my pc to try Revolt out and ran into an issue with the web not loading. In docker console it looked alright, but when I checked the console in my browser I was getting "ERR_CONTENT_DECODING_FAILED", a quick google search showed something about GZIP. Going into the container and modifying like you did fixed it though.

Don't really have anything else to add, just thought I'd share my part of it as well. At least to what feels to be a similar issue.

insertish commented 2 years ago

Compression plugin appears to have been spitting out incorrectly named files, should be fixed in latest client build.

kuhnchris commented 2 years ago

The "compression plugin" of sirv, or something within revoltchat? And "latest client build" of sirv or directly via docker image of revoltchat?

Thanks!

insertish commented 2 years ago

The issue was with vite-plugin-compression spitting out .gz suffixed files when doing Brotli compression, I believe that caused the issue. Might have been a configuration error, either way I just fell back to default Vite configuration.

kuhnchris commented 2 years ago

OK thanks, I'll try to update the image on my server and try it again with my traefik proxy.

kuhnchris commented 2 years ago

I can confirm this now works in the default config with a reverse proxy like Traefik - closing.