Reputation: 45
I am trying to explicitly update a response header, specifically Server = NULL
.
response.set_header('Server', ' ')
response.add_header('Server', ' ')
I am running server with Paste as:
app.run(host='localhost', port=5010, debug=True, server='paste')
However, I am not able to make changes for parameter Server
. Default response I am getting is " server →PasteWSGIServer/0.5 Python/2.7.13
"
I am able to change other parameters like Content_Type
but when I am running server without Paste as :
app.run(host='localhost', port=5010, debug=True)
I am able to make changes to all parameters.
Please suggest what is the problem and if possible what would be the resolution for this?
Upvotes: 1
Views: 232
Reputation: 36
from bottle import ServerAdapter
class PasteServer(ServerAdapter):
def run(self, handler): # pragma: no cover
from paste import httpserver
from paste.translogger import TransLogger
handler = TransLogger(handler, setup_console_handler=(not self.quiet))
httpserver.serve(handler, host=self.host, port=str(self.port), server_version=" ", **self.options)
paste_server = PasteServer(host="<ip>", port="<port>")
run(server=paste_server)
server_version=" "
This parameter value overrides the server response's "Server" header value. Go through paste's httpserver.py for more details.
server_version -> class WSGIHandler class WSGIHandlerMixin --> version_string --> function serve --> function for parameter details
Upvotes: 2