Commit Graph

1 Commits

Author SHA1 Message Date
Kozuki cb3158aab8
Added an index.html file
From websockify/websocketproxy.py , python http.server module is imported. This module loads a do_GET() -->>send_head() method from SimpleHTTPRequestHandler class https://docs.python.org/3.10/library/http.server.html#http.server.SimpleHTTPRequestHandler.do_GET which eventually results in the directory listing of all items in the current directory from which its original caller was run ( if no index.html or index,htm file exists in that directory ). Otherwise it serves a http 404 response on listdirectory failure.

A possible but unclear fix to bypassing current directory item listing is to run websockify directly https://github.com/novnc/noVNC/issues/294 . Another but not encouraged solution is commenting the "else" block in send_head() method in python http.server.SimpleHTTPRequestHandler class to ignore "index.html" or "index.htm" file to force a http 404 response.

Code: 
....def send_head(self):
....
....if not parts.path.endswith('/'):
....
....for index in "index.html", "index.htm":
....
....#else:
   #    return self.list_directory(path)

The more better solution would be to include an "index.html" file in the parent folder "~/noVNC". This makes customization endless and creates more possibilities for user preferred landing pages.
2022-03-03 20:06:22 -08:00