Fixes in flask site

This commit is contained in:
absurdo 2023-12-02 01:31:04 +01:00
parent 4dd7e4531f
commit c4f97f5139

View file

@ -154,15 +154,25 @@ name_file='/home/{}/{}'.format(system_user, base_name_file)
with open(name_file, 'w') as f:
if path=='/':
f.write("<Location %s.well-known/acme-challenge/>\n" % path)
f.write("ProxyPass !\n")
f.write("</Location>\n")
f.write("ProxyPreserveHost On")
f.write("ProxyRequests Off")
f.write("<Location %s>\n" % path)
f.write("<Location %s>\n" % path[:1])
#ProxyPass unix:/home/root/flask_rest/flaskrest.sock|http://127.0.0.1/
f.write("ProxyPass unix:%sgunicorn.sock|http://127.0.0.1%s\n" % (home_user, path))
f.write("ProxyPassReverse unix:%sgunicorn.sock|http://127.0.0.1%s\n" % (home_user, path))
if path!='/':
f.write("RequestHeader set SCRIPT_NAME %s" % path[:1])
f.write("RequestHeader set X-Forwarded-Proto http")
f.write("RequestHeader set X-Forwarded-Prefix %s" % path[:1])
f.write("</Location>\n")
if path=='/':
f.write("<Location /.well-known/acme-challenge/>\n")
f.write("ProxyPass !\n")
f.write("</Location>\n")