Flask + mod_wsgi + httpd: all resources checked on DocumentRoot?

brief information

I have a WSGI script installed in /app . If I request /app/resource , I get the correct answer. But I also get an entry in my error log, as if I had requested /resource . What can cause this?

More details

I have a Flask application deployed with Apache 2.4 + mod_wsgi on AWS EC2:

  • The application runs in /my/app/path
  • The app.wsgi file is located in /var/www/wsgi and points to /my/app/path
  • The Apache configuration for www.website.com vhost points to the WSGI script:
    WSGIScriptAlias /app /var/www/wsgi/app.wsgi

When I GET www.website.com/app/some_resource/... , I get the expected response for this resource with code 200 .

However, when I check the Apache error logs, I find a lot of entries for rejected requests, for example:

[authz_core:error] [pid XXXXX] [client XXXXX] XXXXX: client denied by server configuration: /var/www/html/some_resource

Reported errors correspond 1-to-1 with queries, which, as indicated, return 200 .

Now /var/www/html is the default DocumentRoot, but the request is sent to the /app location and is correctly transmitted and processed by the WSGI application through the alias directive.

And so: why can I find these entries in my error logs, in which the /app path is deleted, and the path to the resource is added directly (and correctly rejected) in the root?

Follow-up

To respond to Graham's suggestions in the comments:

  • There are no specific Apache rewrite rules.
  • Apache not configured with MultiViews
  • These are JSON resources; errors are not the result of sub-requests from the loaded document.
  • The problem persists without symbolic links.

Update

A colleague tells me that he was facing the same problem on AWS EC2 instances.

+6
source share

All Articles