Holger,

On 4/10/26 8:39 AM, Holger Klawitter wrote:
I have made a strange observation with the cgi servlet (enabled in
local web.xml) using tomcat 9.0.117 (also *.111):

when I use a subdirectory as a url pattern, everything works fine,
but when I use a file suffix pattern, the scripts are not being found and
I am getting 404.

     <servlet>
         <servlet-name>cgi</servlet-name>
         <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
         <load-on-startup>5</load-on-startup>
         <init-param>
           <param-name>executable</param-name>
           <param-value>/usr/bin/python3</param-value>
         </init-param>
     </servlet>

     <servlet-mapping>
       <servlet-name>cgi</servlet-name>
       <url-pattern>/bin/*</url-pattern><!-- works -->
       <url-pattern>*.py</url-pattern><!-- does not work -->
     </servlet-mapping>

* Priviledged is enabled
* no cgiPathPrefix is set.
* I tried with and without the executable init-param
* python is there and the script exists in ./simple.py and bin/simple.py

What's wrong here?

I can provide a minimal war file if needed.

The CGIServlet requires a path-mapping and won't work with an extension mapping. It's non-trivial to make an extension mapping work, and typically in a web application all CGIs are rooted in the same place, anyway.

So you'll need to use a path-mapping.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to