我有一个在Windows EC2实例上运行的Flask服务器。
我需要使用https协议来安装它,所以我的设置是这样的:
这是我的Caddy配置:
example.com:443{
proxy / 127.0.0.1:8080
tls [email protected]
}
一切正常,除了在我的application.py文件中,当我这样做时:
return redirect(url_for('test', filename=filename))
我的网络浏览器重定向了我:
与相同的结果 _external=True
但是在模板页面上,例如https://example.com/test2使用render_template( "test2.html")
我是否有链接呈现<a href="{{ url_for('index') }}" />
的HTML生成的很好:https : //example.com/
目前,我已经在application.py中对我的网址进行了硬编码,但这不是我想要保留的方式...
我已经将Caddyfile更新为此,现在一切正常!
example.com:443 {
proxy / 127.0.0.1:8080 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
websocket
}
tls [email protected]
}
这个答案给了我一个提示。
这个答案帮助我建立了Caddyfile。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句