Adding mime-type on URI
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
Hello. I'm new to IPFS, but I have successfully visited a static web page and it blew my mind. However, because IPFS shakes the foundation of the Internet, it directly conflicts with the dominant HTTP standard, so I hit a roadblock quite quickly. **There is no concept of a Content-Type header in IPFS.** We are in a transition between a legacy and an innovation, so I see that the go-ipfs server that runs on localhost (127.0.0.1:8080) bridges the old with the new, allowing a static page to be visited by the existing web browsers.
But I have noticed that go-ipfs is opinionated regarding files. It has decided that ".html" files are to be served as 'text/html':
LINK:
```text
http://127.0.0.1:8080/ipfs/QmcXQajAcP1RnUroQk147VoCtpeH2NTSSLrkhmv7FVZ9kH
```
HTTP HEADER:
```text
Content-Type: text/html
```
I'm suggesting the following change: the parameters passed on the URI can make changes to how the content is served by go-ipfs. As an example, the following URI would serve the file as 'text/plain', even if it was a file has an '.html' extension:
LINK:
```text
http://127.0.0.1:8080/ipfs/QmcXQajAcP1RnUroQk147VoCtpeH2NTSSLrkhmv7FVZ9kH?Content-Type=text/plain
```
HTTP HEADER:
```text
Content-Type: text/plain
```
By doing it this way, you'll be allowing web developers to choose how their content is treated by web browsers. I hope I have explained my point. If go-ipfs already has something like this, please point me to the right direction.
Contributor guide
Assessment
This issue has not been assessed yet.