I have previously set up a successful virtual environment to host a Flask
app, and proxied to it so that I could use a python version different than
that of the main Apache mod_wsgi as described HERE
<https://groups.google.com/forum/#!topic/modwsgi/MRKdrcgRN6E>.
RRFexpire has been working great for a couple months and now I want to
deploy a new Flask app. This will replace and not supplement RRFexpire, so
there will only be one VirtualHost defined in httpd.conf. Other existing
Flask apps are just defined in the main body of the Apache config, for
example:
WSGIDaemonProcess Repeaters python-home=/usr/local/bin/anaconda3
user=apache group=apache threads=5
WSGIScriptAlias /reticlerepeat /var/www/flask/repeaters/repeaters.wsgi
<Directory /var/www/flask/repeaters>
WSGIProcessGroup Repeaters
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
My project is structured as
/home/neild/public_html/ndapps/
ndapps.wsgi
ndapps.py
venv/
static/
style.css
klarity.png
templates/
base.html
index.html
I want this to be accessed at http://deptserver.city.micron.com/ndapps
I setup mod_wsgi-express exactly as before:
mod_wsgi-express setup-server ndapps.wsgi --port=8001 --user apache --group
apache --server-root=/etc/mod_wsgi-express-8001
As well as updating Apache exactly as I had it previously configured:
<VirtualHost *:80>
ServerName deptserver.city.micron.com
ProxyPass /ndapps http://localhost:8001/
ProxyPassReverse /ndapps http://localhost:8001/
RequestHeader set X-Forwarded-Port 80
</VirtualHost>
And my ndapps.wsgi contains only
import sys
sys.path.insert(0, '/home/neild/public_html/ndapps')
from ndapps import app as application
The app works beautifully when directly accessed via the port number as
http://deptserver.city.micron.com:8001
However, at http://deptserver.city.micron.com/ndapps
<http://lelrdaapps01.lehi.micron.com/ndapps>, the page is displayed without
styling, and when I enter info and submit a form, the next page is not
found.
“The requested URL /display was not found on this server.”
And the error log shows
[error] [client 10.xxx.xxx.166] File does not exist: /var/www/html/display,
referer: http://deptserver.city.micron.com/ndapps/
<http://lelrdaapps01.lehi.micron.com/ndapps/>
I have tried many different server-setup configurations, including all
combinations of
--trust-proxy-header X-Forwarded-Host
--trust-proxy-header X-Forwarded-Port
--trust-proxy-header X-Forwarded-For
--trust-proxy-header X-Forwarded-Scheme
-–document-root static
-- proxy-mount-point /ndapps http://localhost:8001/ndapps/
Following along with examples from the blog link
<http://blog.dscpl.com.au/2015/07/redirection-problems-when-proxying-to.html>,
I can access the files in the static folder directly, but trying
http:// <http://lelrdaapps01.lehi.micron.com/ndapps/static>deptserver.city
<http://lelrdaapps01.lehi.micron.com/ndapps>.micron.com/ndapps/static
<http://lelrdaapps01.lehi.micron.com/ndapps/static> gives me a 404 error
and redirects me to http://
<http://lelrdaapps01.lehi.micron.com/ndappsstatic/>deptserver.city
<http://lelrdaapps01.lehi.micron.com/ndapps>.micron.com/ndappsstatic/
<http://lelrdaapps01.lehi.micron.com/ndappsstatic/>
Then I tried to add trailing slashes in ProxyPass and ReverseProxyPass
directives in Apache config. This did not help, and just redirects me from
http:/ <http://lelrdaapps01.lehi.micron.com/ndapps/static>/deptserver.city
<http://lelrdaapps01.lehi.micron.com/ndapps>.micron.com/ndapps/static
<http://lelrdaapps01.lehi.micron.com/ndapps/static> to http://
<http://lelrdaapps01.lehi.micron.com/ndapps/static/>deptserver.city
<http://lelrdaapps01.lehi.micron.com/ndapps>.micron.com/ndapps/static/
<http://lelrdaapps01.lehi.micron.com/ndapps/static/>
When testing with curl command, I do notice that it connects to a proxy on
port 8080 before the GET. Could this be confusing mod_wsgi-express?
I have been working on this for two weeks and feel stuck by wanting this
fixed for publishing the new app. I would love to hear any other ideas of
where to look to resolve getting styling applied and the Flask links
working to access this app by URL instead of port.
Thanks, Neil
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.