openlayers cgi proxy跨域问题总结
转:http://blog.csdn.net/wd4java/article/details/45502169
1、一定要在init方法里调用,代码如下
- OpenLayers.ProxyHost = ‘/CERPGIS/cgi/proxy.cgi?url=’;//代理
2、proxy.cgi配置
- allowedHosts = [‘www.openlayers.org’, ‘openlayers.org’,
- ‘labs.metacarta.com’, ‘world.freemap.in’,
- ‘prototype.openmnnd.org’, ‘geo.openplans.org’,
- ‘sigma.openplans.org’, ‘demo.opengeo.org’,
- ‘www.openstreetmap.org’, ‘sample.azavea.com’,
- ‘v2.suite.opengeo.org’, ‘v-swe.uni-muenster.de:8080’,
- ‘vmap0.tiles.osgeo.org’, ‘www.openrouteservice.org’,
- ‘172.31.170.98:8088′,’localhost:8080’]
注意上面最后一行的ip地址配置是你要访问的服务器地址 ,设置为允许访问
3、在tomcat的conf文件下的content.xml里配置
- <Context privileged=“true”>
开放cgi serverlet权限
4、修改web.xml时注意Python设置
- <init-param>
- <param-name>executable</param-name>
- <!–此处需要安装python–>
- <param-value>D:/Python27/ArcGIS10.2/python.exe</param-value>
- </init-param>
设置python路径,注意python环境变量
转载自:https://blog.csdn.net/wt346326775/article/details/53019616