I have a django app. The code snippet for the function load_form(request) in views.py.
”’
def load_form(request):
if request.method == 'POST':
newQAForm = QAForm(request.POST)
if newQAForm.is_valid():
instance = newQAForm.save(commit=False)
instance.save(using='RadDataWarehouse')
return redirect('confirmation')
”’
and another function
”’
def confirmation(request):
return render(request, 'confirmation.html')
”’
It runs well in local. It will direct it to http://127.0.0.1:8000/confirmation/ after save the form to database.
After I deployed it to linux server. I had a issue after save it to database. It will direct to https://abcdomain.com/confirmation/; But I suppose it will go to https://abcdomain.com/protocolqa/confirmation/
The nginx.conf for the Reverse Proxy is below:
”’
location /protocolqa/ {
proxy_pass http://localhost:8511/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Script-Name /protocolqa;
proxy_set_header X-Original-URI $request_uri;
}
”’
how to fix it and let it got to https://abcdomain.com/protocolqa/confirmation/