request the index page, the server determines if the client is logged in. If not, redirects to the login page(I want is mydomain/login
).but I receive the redirection is localhost\login
I queried some of caddy documents but didn’t find a solution
part of python code
@app.route('/')
def index():
if session.get('username'):
return render_template('index.html')
else:
return redirect(url_for('login'))
my caddy configuration
domain {
tls myemail
gzip
timeouts none
proxy / localhost:5000
}
curl output
# curl -i https://mydomain
HTTP/2 302
content-type: text/html; charset=utf-8
date: Tue, 21 May 2019 14:11:54 GMT
location: http://localhost:5000/login
server: Caddy
server: Werkzeug/0.15.2 Python/3.6.7
content-length: 217
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="/login">/login</a>. If not click the link.
what should I do ?