Skip to content

ingtshan/simple-web-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web代理服务

这是一个基于Node编写的web代理服务器。用于解决web站点的跨域请求问题,和GIS(如Cesium平台下)开发中资源跨域请求问题的解决。

运行命令

首次运行前安装依赖

npm installcnpm install

运行启动代理服务

npm run serve

使用说明

按命令运行启动后,打开浏览http:https://localhost:1987/proxy/ 将该地址放在之前原有请求url前即可。

比如原请求地址为:http:https://mt1.google.cn/vt/lyrs=s&x=0&y=0&z=0
加代理后请求地址为:http:https://localhost:1987/proxy/http:https://mt1.google.cn/vt/lyrs=s&x=0&y=0&z=0

运行效果

在线Demo

Cesium技术栈下

在Resource类中传入proxy属性即可

var resource = new Cesium.Resource({
    url : 'http:https://www.earthenterprise.org/3d',
    proxy : new Cesium.DefaultProxy('http:https://localhost:1987/proxy/')
}

Mars3D技术栈下

在config.json或相关图层配置proxy属性即可,具体参考支持proxy属性的类的API文档

  {
        "name": "高德实时路况",
        "type": "gaode",
        "layer": "time",
        "proxy": "http:https://localhost:1987/proxy/"
  }

About

简单的web代理服务器

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 88.2%
  • HTML 11.0%
  • Batchfile 0.8%