讨论区 » AAS-V10企业版 »
https请求重定向500
堆栈:
2024-09-23 18:21:52.255 [LogoutAsyncThread-thread-4]ERROR Httpclientutil Exception in Httpclientutil.post,url:http://sz.edu.cn/desktop/backend/shiro-cas?from=ew
org.apache.http.client.ClientProtocolException:null
at org.apache.http.impl.client.InternalHttpclient.doExecute(InternalHttpclient.java:187)
at org.apache.http.impl.client.CloseableHttpclient.execute(CloseableHttpclient.java:83)
at org.apache.http.impl.client.CloseableHttpclient.execute(CloseableHttpclient.java:108)
at org.jasig.cas.Utils.http.Httpclientutil.post(Httpclientutil.java:215)
at org.jasig.cas.Utils.http.Httpclientutil.post(Httpclientutil.java:201)
at org.jasig.cas.util.HttpclientsMessageSender.call_aroundBody(Httpclient.java:222)
at org.jasig.cas.util.HttpclientsMessageSender.call_aroundBodylsadvice(Httpclient.java:57)
at org.jasig.cas.util.HttpclientsMessageSender.call(Httpclient.java:1)
at org.jasig.cas.util.HttpclientsMessageSender.call(Httpclient.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutorsWorker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by:org.apache.http.client.CircularRedirectException:Circular redirect to 'https://sz.edu.cn/desktop/backend/casclient/index'
at org.apache.http.impl.client.DefaultRedirectstrategy.getLocationURI(DefaultRedirectstrategy.java:177)
at org.apache.http.impl.client.DefaultRedirectstrategy.getRedirect(DefaultRedirectstrategy.java:221)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:122)
at org.apache.http.impl.client.InternalHttpclient.doExecute(InternalHttpclient.java:185)
... 12 common frames omitted
原因:客户在应用服务器上层有nginx,https://A请求通过nginx转发是带了X-Forwarded-Proto头的,但是应用服务器重定向请求B是没有X-Forwarded-Proto头,默认就按http处理请求了,之后http://B请求又进入nginx,这时候https://A请求没有达到最终的目的地故触发了异常
解决方案:在domains/mydomain/config/domain.xml对应的实例配置中的network-listener新增属性 valve-class-name="org.apache.catalina.valves.RemoteIpValve",修改后重启中间件,如果是独立实例就在重启中间件后,再重启实例