简体   繁体   中英

How to remove response header from restify framwork

How can I remove a property from the restify response header?

I tried these solutions but working for restify.

    // res.removeHeader("Server"); //Not working
    // res.set("Server", ""); //Adding new header, not updating.
    // res.disable("Server") // Error res.disable is not a function.
  next();
});

The server - header is set by restify itself. You can remove it by setting the server - name to an empty string like this:

const server = restify.createServer({
   name: ''
});

I feel like this should be in the documentation . They are informing about this only indirectly:

options.name String Name of the server. (optional, default "restify")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM