Project Purpose: STB Portal
Environment Description:
1, using Nginx 1.8.1 load static page *.html, on the static page to invoke the service interface ;
2, Tomcat 6 load project;
Problem: The Set-top box cannot access the page and cannot load the data.
Analysis:
1, check the interface log, incoming and outgoing information are normal;
2, grab the packet, analysis data show no problem.
Ajax is not receiving the returned data information, looked for a long time this problem, the original is cross-domain to intercept.
Process
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/3A/wKioL1gNo5qwmyP6AABRBQysXUo828.png-wh_500x0-wm_3 -wmp_4-s_3217498546.png "title=" flowchart "alt=" Wkiol1gno5qwmyp6aabrbqysxuo828.png-wh_50 "/>
Solution 1:
Modify the Tomcat configuration file Tomcat/conf/web.xml, modify the filter configuration, add:
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Note: The tomcat version needs to be above tomcat7.0.4;
Solution 2:
Modify Nginx configuration file, this does not do the verification, here does not do the detailed description.
Special thanks to teacher Yang, money teacher.
Nginx and Tomcat cross-domain issues