Skip to content

Add support for HEAD methods in Spring's Resource handling #28291

Closed
@hannosgit

Description

@hannosgit

Affects: Spring Web 5.3.18
Tested with: Tomcat and Jetty
Tested with: Linux and Windows


I want to download large files (>10GB) from a Spring Web Server, before I start the download I want to know the size of the remote file, so, therefore, I make a HEAD request on the remote file.

Static files are served via ResourceHandlers, eg.

@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry
            .addResourceHandler("/**")
            .addResourceLocations("file:download/");
    }

}

and then when I make a HEAD request on a large file (> 10 GB), on the first try I get the response within milliseconds but when I try again the response takes seconds ( >10s).

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions