0

I am serving binary data through http. For the time being I use Content-Disposition: attachment.

Can I use the built in http compression (having the client request data with the header Accept-Encoding) to compress the attachment?

Or should I compress the attachment manually?

What is the proper way of serving compressed byte arrays through http?

1 Answer 1

1

Content-disposition is merely a header instructing the browser to either render the response, or to offer it as a download to the user. It doesn't change any HTTP semantics, and it doesn't change how the response body is transferred or interpreted.

So just use the built-in compression that compresses the response body according to the request header Accept-encoding.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. I was using akka-http where application-octet/stream is not compressible by default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.