Compression not working on Railway, works on Local

railay
HOBBY

10 months ago

I have a Python web app that uses a compression middleware. The middleware supports Brotli and uses Gzip as a fallback. The responses are correctly compressed on my local machine, but when serving over Railway, they are served uncompressed.

2 Replies

railay
HOBBY

10 months ago

34108dc5-7795-469f-b853-2863bbedfa6f


10 months ago

Railway's proxy does not currently support proxying compressed requests and responses.


railay
HOBBY

10 months ago

Not sure I understand. I found this related thread and they were using Brotli



10 months ago

yep, it was enabled and then decided later to be disabled again


railay
HOBBY

10 months ago

Oh. Is there an ETA to enable it again?


railay
HOBBY

10 months ago

This affects user experience and egress costs


10 months ago

we don't currently have any immediate plans that I'm aware of to enable this at the proxy level


10 months ago

when enabled our proxy has to do the compression and decompression for every request.


railay
HOBBY

10 months ago

Was this announced? It's an important feature to support, compression would reduce my responses by ~80%


10 months ago

it was not announced


railay
HOBBY

10 months ago

It has SEO implications too


10 months ago

I'm sorry but it wasn't economical for us, in the future we may look into allowing the user's server and client do the compression instead of our proxy.


railay
HOBBY

10 months ago

Ok, please bubble this up to the powers that be. I really love using railway, but I'm going to have to test some other service providers now


10 months ago

for context a beloved ex railway employee has asked for it, so we will likely be giving it a serious thought


railay
HOBBY

10 months ago

Thanks. I really hope you guys can add back the support. Performance is important for me and my users


railay
HOBBY

10 months ago

Will it help if I write a note in the feedback channel?


10 months ago

if we do add it back, it wouldn't be at the proxy level, your server and client would be responsible for compression.


railay
HOBBY

10 months ago

Does that just mean I bear the CPU cost? Or are there other tradeoffs?


10 months ago

that's correct


10 months ago

no need for a new thread, you can bump this thread -

the rest of the team will be back at work Tuesday, so expect some kind of answer there by EOW


railay
HOBBY

10 months ago

Perfect, thank you sir


10 months ago

no problem, going to solve this, please bring further discussion to that linked thread.


robtangle
HOBBY

10 months ago

Brody, just to get it right, does this mean that even though my client is sending the correct Accept-encoding headers and I have a compression middleware in my nodejs server, the response won't be delivered as compressed?
I'm experiencing the same issue where the response gets correctly compressed when running my nodejs server locally, but when deployed in Railway the compression doesn't work nor the Content-Encoding header is present.
I'm not using any reverse proxy. Just the Nestjs server, with the compression middleware, and the client is just a react app using axios.
Is there a work around for this?
Thanks in advance.


10 months ago

that's correct, compression is disabled at the proxy level


robtangle
HOBBY

10 months ago

Thanks for the response, Brody.
Is there any workaround for this? Is there any way that I can deploy my server on Railway and still be able to use compression for just the common uses of json, text or scripts?


10 months ago

as it has been disabled at the proxy level there would be no workaround.

please bump the linked thread made by greg.


10 months ago

@Railay - we have pushed a change, as long as your server code and client support compression, your responses will be compressed


railay
HOBBY

10 months ago

Thanks! I’ll check it out when I get home


10 months ago

read more about it here -


Compression not working on Railway, works on Local - Railway Help Station