Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disabling some headers set by Express's static middleware.
var express = require("express");
var onHeaders = require("on-headers");
var path = require("path");
var app = express();
// ...
app.use(function(req, res, next) {
onHeaders(res, function() {
res.removeHeader("Accept-Ranges");
});
next();
});
var myStaticPath = path.resolve(__dirname, "static");
app.use(express.static(myStaticPath));
// ...
app.listen(1337);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment