hexo-server icon indicating copy to clipboard operation
hexo-server copied to clipboard

Custom mime type for extensionless files

Open lyonzy opened this issue 8 years ago • 2 comments

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

lyonzy avatar Mar 31 '16 09:03 lyonzy

+1 Yes please!! Been using nginx to hack around this when developing locally.

shirotech avatar Nov 13 '16 08:11 shirotech

I am having the same problem, the default mime type for me is also incorrect.

egonbraun avatar May 27 '20 14:05 egonbraun