Nginx + Tomcat 配置https后,发现前端页面加载js、css、img等资源文件路径不正确。
通过排查发现请求头中的 request.getScheme() 加载的文件路径还是http,而不是https。
解决方法:
修改tomcat配置文件server.xml,增加 scheme="https" secure="true" 属性即可。
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" scheme="https" secure="true/>