This commit is contained in:
caandt 2024-09-19 21:17:42 -05:00
parent 3bc3b34c67
commit 47af2ede1c
3 changed files with 12 additions and 4 deletions

4
app.py
View file

@ -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')

View file

@ -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;
}
}
}

View file

@ -4,7 +4,7 @@ title: message
<div class="container">
<div class="panel f">
<h2>contact</h2>
<form method="post" action="/api/message">
<form method="post" action="/_/message">
<label><input type="text" name="name" value="" required>name</label>
<label><input type="text" name="email" value="">email / other contact info</label>
<br>