我在8080端口上运行Tomcat。我有一个apache2代理,它有SSL证书,它将所有加密的流量从443端口传递到8080端口。除了facebook身份验证之外,所有的工作都很好。
如果apache2处于关闭状态,而tomcat中的SSL处于打开状态,则它可以正常工作。我相信流量加密的问题,也许facebook从我的非SSL tomcat服务器上检索到了请求?
我的apache配置:
ServerName thing-tracker.ga SSLEngine On SSLCertificateFile /opt/cert/cert.pem SSLCertificateKeyFile /opt/cert/privkey.pem SSLCertificateChainFile /opt/cert/chain.pem DefaultType text/html
ProxyRequests off
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
# ProxyPass / http://localhost:8080/
# ProxyPassReverse / https://localhost/
错误:
由于异常,从request /login/oauth2/code/facebook转发到错误页面
[读取OAuth 2.0错误时出错: JSON解析错误:无法从START_OBJECT令牌中反序列化java.lang.String实例;
嵌套异常是com.fasterxml.jackson.databind.exc.MismatchedInputException:无法反序列化java.lang.String的实例,该实例超出Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 1, column: 10处的START_OBJECT标记;
发布于 2019-09-17 10:09:43
尝试在apache上强制使用https:
RequestHeader set X-Forwarded-Proto https
在您的spring boot属性中添加:
server.use-forward-headers=true
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-proto我也有同样的问题,但这个问题解决了。
https://stackoverflow.com/questions/56773884
复制相似问题