Skip to content

Conversation

@mathias82
Copy link

Summary

This PR introduces support for serving static files from a local directory,
configurable via quarkus.http.local-static-resources.*.

New configuration

quarkus.http.local-static-resources.enabled=true
quarkus.http.local-static-resources.path=/local-static/
quarkus.http.local-static-resources.directory=local-static

Tests

Added LocalStaticResourcesTest which verifies:

  • Serving an existing file
  • Returning 404 when missing

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 23, 2025

Thanks for your pull request!

Your pull request does not follow our editorial rules. Could you have a look?

  • title should not contain an issue number (use Fix #1234 in the description instead)

This message is automatically generated by a bot.

@mathias82 mathias82 changed the title Add support for serving static resources from a local directory in Vert.x HTTP #39968 Add a configuration to serve a local directory with a static handler #39968 Nov 23, 2025
@mathias82 mathias82 changed the title Add a configuration to serve a local directory with a static handler #39968 Add a configuration to serve a local directory with a static handler Fix #39968 Nov 23, 2025
@mathias82 mathias82 force-pushed the feature-static-local-dir branch 4 times, most recently from dd79a29 to 2bc57dc Compare November 24, 2025 12:08
Copy link
Contributor

@ia3andy ia3andy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just cleaning non changed files

HttpServerCommonHandlers.applyFilters(filtersInConfig, httpRouteRouter);
// Headers sent on any request, regardless of the response
HttpServerCommonHandlers.applyHeaders(httpConfig.header(), httpRouteRouter);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove those changes I think

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

*/
@ConfigDocSection
WebsocketServerConfig websocketServer();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ia3andy
Copy link
Contributor

ia3andy commented Nov 24, 2025

I also forgot, you need to add those files as watched for livereload

@mathias82 mathias82 force-pushed the feature-static-local-dir branch from 9744cb6 to 691e79a Compare November 24, 2025 14:05
@mathias82
Copy link
Author

I also forgot, you need to add those files as watched for livereload

ii have added @ia3andy

@mathias82 mathias82 force-pushed the feature-static-local-dir branch from 691e79a to 4a1de61 Compare November 24, 2025 14:16
@mathias82 mathias82 requested a review from ia3andy November 24, 2025 14:18
return;
}

String normalizedDir = Path.of(dir).normalize().toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might need toAbsolutePath here, because AFAIK the watcher is using absolute path for non resources. Debug to be sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a configuration to serve a local directory with a static handler

2 participants