openlayers cgi proxy跨域问题总结

转:http://blog.csdn.net/wd4java/article/details/45502169

1、一定要在init方法里调用,代码如下

[html] view
plain
 copy

  1. OpenLayers.ProxyHost = ‘/CERPGIS/cgi/proxy.cgi?url=’;//代理  


2、proxy.cgi配置

[html] view
plain
 copy

  1. allowedHosts = [‘www.openlayers.org’, ‘openlayers.org’,   
  2.                 ‘labs.metacarta.com’, ‘world.freemap.in’,   
  3.                 ‘prototype.openmnnd.org’, ‘geo.openplans.org’,  
  4.                 ‘sigma.openplans.org’, ‘demo.opengeo.org’,  
  5.                 ‘www.openstreetmap.org’, ‘sample.azavea.com’,  
  6.                 ‘v2.suite.opengeo.org’, ‘v-swe.uni-muenster.de:8080’,   
  7.                 ‘vmap0.tiles.osgeo.org’, ‘www.openrouteservice.org’,  
  8.                 ‘172.31.170.98:8088′,’localhost:8080’]  


注意上面最后一行的ip地址配置是你要访问的服务器地址 ,设置为允许访问

3、在tomcat的conf文件下的content.xml里配置

[html] view
plain
 copy

  1. <Context privileged=“true”>  


开放cgi  serverlet权限

4、修改web.xml时注意Python设置

[html] view
plain
 copy

  1. <init-param>  
  2.     <param-name>executable</param-name>  
  3.     <!–此处需要安装python–>  
  4.     <param-value>D:/Python27/ArcGIS10.2/python.exe</param-value>  
  5. </init-param>  

设置python路径,注意python环境变量

转载自:https://blog.csdn.net/wt346326775/article/details/53019616

You may also like...

退出移动版