From 47af2ede1cfbe8d528c237ccf0320e547f102096 Mon Sep 17 00:00:00 2001 From: caandt Date: Thu, 19 Sep 2024 21:17:42 -0500 Subject: [PATCH] flask --- app.py | 4 ++-- nginx.conf | 10 +++++++++- pages/contact.html | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index ba60675..30d0593 100644 --- a/app.py +++ b/app.py @@ -3,8 +3,8 @@ import json app = Flask(__name__) -@app.post('/api/message') +@app.post('/_/message') def message(): with open('message.txt', 'a') as f: f.write(json.dumps(request.form)) - return redirect('http://localhost:8080') + return redirect('/contact') diff --git a/nginx.conf b/nginx.conf index 5dc2686..c7bc7f7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -16,10 +16,18 @@ http { try_files $uri $uri.html $uri/ =404; autoindex on; types { - text/html html htm shtml; + text/html html; text/css css; application/javascript js; + image/x-icon ico; } } + location /_/ { + proxy_pass http://127.0.0.1:5000; + 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; + } } } diff --git a/pages/contact.html b/pages/contact.html index 204ac5d..d63375c 100644 --- a/pages/contact.html +++ b/pages/contact.html @@ -4,7 +4,7 @@ title: message

contact

-
+