I need Quarkus to serve my wasm file with Content-Type header application/wasm
instead of application/octet-stream
. I explicitly use the quarkus-undertow extension.
First I tried to use the undertow-handlers.conf
to set the content type like this:
path-suffix('.wasm') -> set("o{Content-Type}", "application/wasm")
For other headers this works without problem, but the Content-Type seems to be overwritten by a following handler.
After this I tried to add a web.xml under src/main/resources/META-INF
with a mime mapping for wasm files like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<mime-mapping>
<extension>wasm</extension>
<mime-type>application/wasm</mime-type>
</mime-mapping>
</web-app>
This approach doesn't seem to have any effect on the Content-Type.
What is the correct way to overwrite mime type mappings for static files in Quarkus? Why does the web.xml configuration not work?
Update
The web.xml approach from above works since Quarkus 1.1.1.Final.