-
Notifications
You must be signed in to change notification settings - Fork 11
Gateway content-type response header #224
Comments
I feel this requires clarification, as it may not be clear what is wrong on the first sight. Sample SVG image at /ipfs/QmWBNMp6JxXj5aYrpef8z2xaPC7DeGftG4jTy6EyF958o4 The problem is that resource returned as My guess is that go-ipfs probably uses standard mime-type sniffer from golang [1] which defaults to It does not seem to work correctly now, but you may want to subscribe to related issues about mime-type in go-ipfs:
1: https://golang.org/src/net/http/sniff.go |
awesome, thank you |
Maybe it helps to wrap the svg in a directory, in order to have it addressed with a .svg filename: > ipfs add -w file.svg
added Qmsvg file.svg
added Qmfoo
# => /ipfs/Qmfoo/file.svg |
Indeed! If extension is <img src="https://ipfs.io/ipfs/QmQ48wa7jc9JZJ9Lc1XCkuwa3FUYeXcMPJi3vAD78VbBM1/sample.svg" alt="if you see this text it means SVG image failed to load"/> it IS returned as |
The content type detection from the content is only heuristic, so it is better to use file extension for deterministic content type. |
This issue has been moved to https://discuss.ipfs.io/t/gateway-content-type-response-header/357. |
Is there a way to set the header of what the gateway will return as content-type. I have an issue right now when serving svg files. Since the content-type is text, browsers do not recognize it properly and will not display the image.
The text was updated successfully, but these errors were encountered: