From 1d9b7d855d633da6388daf663398449cfc0e6ab6 Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Thu, 19 Oct 2017 13:20:06 +0200 Subject: [PATCH] Update Python simple server script to allow subdomains --- StandaloneViewer/etc/redirectingSimpleServer.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/StandaloneViewer/etc/redirectingSimpleServer.py b/StandaloneViewer/etc/redirectingSimpleServer.py index af8bba16d..2d83cb42c 100644 --- a/StandaloneViewer/etc/redirectingSimpleServer.py +++ b/StandaloneViewer/etc/redirectingSimpleServer.py @@ -3,9 +3,23 @@ import urlparse, os PORT = 3000 +## Note: If you set this parameter, you can try to serve files +# at a subdirectory. You should use +# -u http://localhost:3000/subdirectory +# when building the application, which will set this as your +# ROOT_URL. +#URL_PATH="/subdirectory" +URL_PATH="" + class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): + # Strip the subdirectory from the PATH + # e.g. localhost:3000/subdirectory/packages/ohif_polyfill/svg4everybody.min.js + # is interpreted by this script as localhost:3000/packages/ohif_polyfill/svg4everybody.min.js + # so the file is found properly. + self.path = self.path.replace(URL_PATH, "") + # Parse query data to find out what was requested parsedParams = urlparse.urlparse(self.path)