armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Support for HTTP Range Request

Open blyxa opened this issue 3 months ago • 3 comments

Is HTTP range request supported in Armeria?

I have a use case where I'm using com.linecorp.armeria.server.file.FileService to serve large video files. On the client side, ios/AVFoundation by default makes a HEAD and then a Range request. This is something I can't change on the client side, so I have to support Range request on the server side.

I dug around the source and github issues but only found mentions of HEAD support but FileService doesn't seem like it supports HEAD.

% curl -I  'http://localhost8080/videos/foo.mp4'
HTTP/1.1 405 Method Not Allowed
content-type: text/plain; charset=utf-8
content-length: 22
server: Armeria/1.33.1

Can someone point me in the right direction?

blyxa avatar Sep 08 '25 03:09 blyxa

Hi, I don't think range headers are supported natively by FileService at the moment.

I do think a quick fix is for FileService to respond to a HEAD method with Accept-Ranges: none, indicating that ranged responses are not available and only the full response is available. Would this be helpful for your scenario?

Alternatively, I think we would be open to adding an API extension for supporting range queries in FileService as well. The design process will probably take longer though.

jrhee17 avatar Sep 08 '25 06:09 jrhee17

I think HEAD response with Accept-Ranges: none is a good quick solution. Looks like, this should make AVFoundation/AVPlayer fallback to full download at the cost of disabled video seeking.

blyxa avatar Sep 08 '25 06:09 blyxa

#6395 was merged, but since the range request isn’t implemented yet, I'll keep this issue open.

ikhoon avatar Sep 16 '25 01:09 ikhoon