Arcgis server服务跨域配置
一、系统环境
操作系统:windows 10
软件版本:arcgis server10.2
二、操作步骤
1、需要下载两个文件cors-filter-1.7.jar,Java-property-utils-1.9.jar放到安装目录C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\lib下,
2、修改arcgis server安装目录C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\conf\web.xml的文件,在490行左右添加以下代码
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, POST, HEAD, PUT, DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
</init-param>
<init-param>
<param-name>cors.exposedHeaders</param-name>
<param-value>Set-Cookie</param-value>
</init-param>
<init-param>
<param-name>cors.supportsCredentials</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
保存之后,重启arcgis server服务即可。