Python SimpleHTTPServer: change response header


I use python's SimpleHTTPServer for tests applications.

Now for the test I need to change in the server response header field "Server". Now I have "Server: SimpleHTTP/0.6 Python/2.7.3" I would like something like "Server: Apache123".

Is it possible to change this field? Thx.


If you wanted to have something easy to edit you could use this:

import SimpleHTTPServer import BaseHTTPServer def main(): request_handler = SimpleHTTPServer.SimpleHTTPRequestHandler request_handler.server_version = "Server: Apache123" request_handler.sys_version = "" BaseHTTPServer.test(HandlerClass = request_handler, ServerClass = BaseHTTPServer.HTTPServer) if __name__ == "__main__": main()

You can run this the same way you run SimpleHTTPServer:

python you_script_name.py port

You could also edit it to take the name you want from the command line.


  • Non type-variable argument in the constraint: MonadError Failure m
  • Delphi 5 & Crystal XI Rel. 2 (RDC) how to?
  • how to make a non-hardcoded URL path in docker image to call backend service?
  • WPToolkit not appear in the references after successful install
  • WPF Toolkit Datagrid Headers and Empty Source
  • How to scale a MapView from Pixels to Meters
  • display a 2 row message pop -up vba 6
  • Android PHP Base64 decode with different results
  • How do I know if was require_once?
  • How to create situational or job specific test program flows?
  • OpenMP and sections
  • mouse over zoom not working in magento
  • Plotly - Create Pie Chart with continuous color scale
  • c++ php and static library
  • How to Restore a old Backup from SQL Server 7 SP4 to newest SQL Server versions? [closed]
  • Can't get JSON data from Rails API
  • Get some trounble when using drawBuffers in WebGL2
  • C++/CLI Thread synchronization including managed and unmanaged code
  • pygame.init() shows as undefined variable after installing Pygame
  • Cannot find “Grammar.txt” in python-sphinx
  • import scipy.sparse failed
  • Calculating ratio of reciprocated ties for each node in igraph
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • pip in virtualenv gets ConnectTimeoutError
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • Jquery popup on mouse over of calendar control
  • gspread or such: help me get cell coordinates (not value)
  • Alternative to overridePendingTransition() - Android
  • How do I get HTML corresponding to current DOM tree?
  • Mysterious problem with floating point in LISP - time axis generation
  • How to create a file in java without a extension
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • Symfony2: How to get request parameter
  • GridView Sorting works once only
  • WPF Applying a trigger on binding failure
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j