404 for symlink with python3 http.server.CGIHTTPRequestHandler

Viewed 37

Is it possible to get http.server.CGIHTTPRequestHandler to run a symlink-ed script?

In the example below, GET /cgi-bin/test.py results in a 404 because it is a symlink.

% mkdir -p test/cgi-bin
% cd test
% vi test.py
% chmod +x test.py
% ln -s test.py cgi-bin
% cp test.py cgi-bin/test2.py
% chmod +x cgi-bin/test2.py
% python3 -m http.server --cgi 8090
Serving HTTP on :: port 8090 (http://[::]:8090/) ...
::1 - - [06/Jan/2022 09:21:48] code 404, message No such CGI script ('/cgi-bin/test.py')
::1 - - [06/Jan/2022 09:21:48] "GET /cgi-bin/test.py HTTP/1.1" 404 -
::1 - - [06/Jan/2022 09:21:59] "GET /cgi-bin/test2.py HTTP/1.1" 200 -
0 Answers
Related