You possibly should be using:
<VirtualHost *:80>
ServerName deptserver.city.micron.com
ProxyPass /ndapps http://localhost:8001/ndapps
ProxyPassReverse /ndapps http://localhost:8001/ndapps
RequestHeader set X-Forwarded-Port 80
</VirtualHost>
So the target URL you are proxying to should have /ndapps at the end. This will
get stripped off by virtue of having --mount-point /ndapps on backend.
Graham
> On 7 Mar 2018, at 6:45 am, neilD <[email protected]> wrote:
>
> Just an update on progress so far..
>
> With a server setup as:
>
>
> mod_wsgi-express setup-server ndapps.wsgi --port=8001 --user apache --group
> apache --server-root=/etc/mod_wsgi-express-8001
> --trust-proxy-header X-Forwarded-Host
> --trust-proxy-header X-Forwarded-Port
> --trust-proxy-header X-Forwarded-For
> --trust-proxy-header X-Forwarded-Scheme
> --mount-point/ndapps
>
>
> Testing at http://lelrdaapps01.lehi.micron.com/ndapps/ and
> http://lelrdaapps01.lehi.micron.com:8001 yield 403
>
> Forbidden
>
> You don't have permission to access / on this server.
>
> And testing http://lelrdaapps01.lehi.micron.com/ndapps yields 404 error
>
>
>
> I verified /ndapps directory and everything below is 755 or 777 for
> permissions. Perhaps my page is trying to pass through this Apache section?
> Even if so, I should be already logged in.
>
>
>
> <Directory /var/www/html/>
> ##### LDAP Login #######################
> AuthType Basic
> AuthName "ProbeEng Webserver: Enter Your Micron Username and Password"
> AuthBasicProvider ldap
> AuthzLDAPAuthoritative off
> AuthLDAPURL "ldap://ldap.city.micron.com/ou=mtworkers,o=micron.com?uid"
> ##### Require Authentication
> Require valid-user
> Order deny,allow
> Allow from all
> </Directory>
>
>
> With server setup as
>
>
> mod_wsgi-express setup-server ndapps.wsgi --port=8001 --user apache --group
> apache --server-root=/etc/mod_wsgi-express-8001
> --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
> --url-alias /ndapps/static /home/neild/public_html/ndapps/static
> --mount-point/ndapps
>
>
> Testing http://lelrdaapps01.lehi.micron.com/ndapps/ yields The requested URL
> / was not found on this server.
>
> Testing http://lelrdaapps01.lehi.micron.com/ndapps yields The requested URL
> /ndapps was not found on this server.
>
>
>
> With server setup as
>
>
> mod_wsgi-express setup-server ndapps.wsgi --port=8001 --user apache --group
> apache --server-root=/etc/mod_wsgi-express-8001
> --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
> --url-alias /ndapps/static /home/neild/public_html/ndapps/static
>
>
>
> Testing "/ndapps" is not found, "/ndapps/" has original problem of no
> styling, and faulty redirects when submitting the form, and ":8001" is
> working perfectly.
>
>
>
> Next, for
>
> Even if you add this and generated links don't include the mount point, it is
> likely because you are generating them the wrong way. Flask has some helper
> function you can use in code and templates to have it generate URLs for you.
> When you use it, it will include the mount point in the generated URLs.
>
> I did confirm that I am using the Flask helper functions as
>
> <form action="{{ url_for('display') }}"
>
>
> And
>
>
> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
>
>
> On my sub-URL mount point, the 'display' function is decorated by:
>
>
> @app.route('/display', methods=['POST', 'GET'])
>
>
> And I have imported each at the top:
>
> from flask import Flask, render_template, request, url_for, redirect
>
>
>
>
> Regarding the next point
>
> When mounting at a sub URL, you may have have to be careful with the route
> for the root of the site in Flask. It needs to be defined so as to do
> trailing slash redirection. That is, if the request comes through as /ndapps,
> you want Flask to redirect that to /ndapps/ first. If you don't do that, you
> can have also sorts of issues with relative links generated from home page of
> the site
>
> I have tried to address this with three attempts so far:
>
> Adding "strict_slashes" setting as described at
> https://stackoverflow.com/a/42668371 <https://stackoverflow.com/a/42668371>
> app = Flask(__name__)
> app.url_map.strict_slashes = False
>
> Logic to check URL from same link above
> @app.before_request
> def before_request():
> if request.path == '':
> return redirect(url_for('index')
> app.config['APPLICATION_ROOT'] = '/ndapps
> Next, I will work through implementing Blueprints and Middleware as described
> at https://stackoverflow.com/a/18967744
> <https://stackoverflow.com/a/18967744> to always add the trailing slash.
>
> As to static files, what is hosting them? The backend mod_wsgi-express? If
> yes, how?
>
> Yes, I believe so via the --document-root directive above. Is there a
> preferred way for me to confirm this?
>
> Also, would it be easier to create this as it's own site address instead of a
> sub URL mount? As ndapps.deptserver.city.micron.com for example. I hesitated
> on this one without knowing how the DNS is implemented at work and how the
> CNAME and A records would need to be defined.
>
> Making progress!
>
>
> --
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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.