3

I have a python wsgi API in which I process incoming URL payloads of varied length. I believe, but am not absolutely sure, that I may have run into a limitation of URL size.

For a particular payload (> 6K characters), it runs fine locally using the Python web server, but when I move it to Apache (on both OS X and RHEL 6), I get a 404 error @ the browser. According to everything I've seen for too large of payload, I should be getting a 413 or 414 error. Please note, that for shorter URLs than this, I have no problems running them in Apache.

I've combed my Apache logs and all I can find is the error that "Target WSGI script not found or unable to stat." Everything I've Googled with this particular error is indicative of an application error, and as noted, I do know my wsgi configuration works. It just seems to break for larger URLs, which makes me think this may be an issue with mod_wsgi.

My VirtualHost config is:

<VirtualHost *:80> Alias /cardiocatalogqt /Library/WebServer/extjs/cardioCatalogQT <Location /cardiocatalogqt> Order deny,allow Allow from all </Location> WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess rest_api user=gregsilverman threads=5 WSGIScriptAlias /api /Library/WebServer/wsgi/rest_api/rest_api.wsgi WSGIPassAuthorization On <Location /api> Order deny,allow Allow from all </Location> </VirtualHost> 

Any suggestions, short of shortening the URLs, would be most welcome.

3
  • We're also hitting this. (The limit seems to be 4096 characters for the full URL, including scheme and hostname, which seems weird) Commented Apr 17, 2019 at 1:20
  • me too; the telltale is that apache reports in the error log Target WSGI script not found or unable to stat when the URL is too long Commented Jul 11, 2021 at 19:50
  • it was reported here also : github.com/GrahamDumpleton/mod_wsgi/issues/652 Commented Jul 11, 2021 at 20:19

1 Answer 1

0

It is not a problem in WSGI, and there is not much you can do. I have analyzed the problem. Apache uses the libapr library, and invokes the function apr_filepath_merge which at a certain point does

if (maxlen > APR_PATH_MAX) { return APR_ENAMETOOLONG; } 

where APR_PATH_MAX in Unix is PATH_MAX that is 4096. Any URL larger that 4096 will trigger this error. Then in ap_core_translate (at line 4734 in file server/core.c in apache source) this returns HTTP_BAD_REQUEST.

1
  • as a side effect, the default of 8192 for LimitRequestLine is quite useless Commented Nov 19, 2022 at 14:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.