import sys import BaseHTTPServer, SimpleHTTPServer from SimpleHTTPProxy import SimpleHTTPProxy SimpleHTTPProxy.set_routes({ 'container_01': 'http://localhost:9999/container_01/', 'container_02': 'http://localhost:9998/container_02/', 'container_03': 'http://localhost:9997/container_03/', 'container_04': 'http://localhost:9996/container_04/' }) httpd = BaseHTTPServer.HTTPServer(("", 8080), SimpleHTTPProxy) host, port = httpd.socket.getsockname() print('Listening on http://%s:%i' % (host,port)) try: httpd.serve_forever() except KeyboardInterrupt: print("\nKeyboard interrupt received, exiting.") sys.exit(0)