Compression not working on Railway, works on Local

railayHOBBY

8 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

railayHOBBY

8 months ago

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


8 months ago

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


railayHOBBY

8 months ago

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



8 months ago

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


railayHOBBY

8 months ago

Oh. Is there an ETA to enable it again?


railayHOBBY

8 months ago

This affects user experience and egress costs


8 months ago

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


8 months ago

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


railayHOBBY

8 months ago

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


8 months ago

it was not announced


railayHOBBY

8 months ago

It has SEO implications too


8 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.


railayHOBBY

8 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


8 months ago

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


railayHOBBY

8 months ago

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


railayHOBBY

8 months ago

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


8 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.


railayHOBBY

8 months ago

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


8 months ago

that's correct


8 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


railayHOBBY

8 months ago

Perfect, thank you sir


8 months ago

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


robtangleHOBBY

8 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.


8 months ago

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


robtangleHOBBY

8 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?


8 months ago

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

please bump the linked thread made by greg.


8 months ago

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


railayHOBBY

8 months ago

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


8 months ago

read more about it here -