Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to set static-web-server to serve file as plain text instead of binary? #476

Closed Answered by joseluisq
kincsescsaba asked this question in Q&A
Discussion options

You must be logged in to vote

If I copy a bpmn file (it's an XML-based markup text) under /public, apparently, I get binary content in my browser. The content is returned with the type application/octet-stream.

It is probably expected because the library used by SWS cannot guess that extension so it can map its content type. In that situation, SWS falls back to application/octet-stream as a "safe-bed".

Can I provide a configuration to map this specific extension to be served as text/plain or anything that won't mess up the character stream?

Yes, you can by using Custom HTTP Headers via a config file. Like this example.

my-config.toml

[general]
root = "/public"

[advanced]

[[advanced.headers]]
source = "**/*.bpmn"
h…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kincsescsaba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v2 v2 release
2 participants