hexojs / hexojs/hexo-server

Custom mime type for extensionless files

Open
#22 2 comments 7 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
81
Forks
55
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm looking to do hosting on S3 without extensions on URLs. What would be really nice here is a custom mime type for files with no extension, that way I can have my html pages created without an extension and just served normally.

The solution I've got currently is this, in lib/middlewares/route.js:
`res.setHeader('Content-Type', extname ? mime.lookup(extname) : config.extensionless_mime_type || 'application/octet-stream');`

and this in _config.yml:
`extensionless_mime_type: 'text/html'`

Would this be a suitable feature request and implementation? If so I can submit a pull request.

Cheers,
Matt

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.