首页 > 其他分享> > tomcat解决跨域配置<Context docBase=“xx“ path=““ reloadable=“true“ crossContext=“true“/>导致项目加载两次
tomcat解决跨域配置<Context docBase=“xx“ path=““ reloadable=“true“ crossContext=“true“/>导致项目加载两次
作者:互联网
springboot打成得war放在tomcat中,每次定时任务都回执行两次,发现原来是启动得时候,项目加载了两次导致,为了解决前后断跨域得问题,在server.xml中配置如下,方可解决问题。
1:Host 中的appBase=""
2:Context 中的docBase=“webapps/xxx”
<Host appBase="" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context docBase="webapps/xxx" path="" reloadable="true" crossContext="true"/>
</Host>
标签:跨域,tomcat,docBase,Context,true,加载 来源: https://blog.csdn.net/bpdwg888/article/details/120487479