1. 为了解决不同网站之间 方法调用和对象传输的问题。
存在 A站点: http://127.0.0.1:8080 主系统
B站点: http://127.0.0.1:8005 子系统的子页面
C站点 http://127.0.0.1:8081 最终访问系统代理地址
如 B站点为反馈采集平台, 那么A系统中 需要引入B站 采集信息的页面,来收集反馈建议和信息。 那么如果A站 和B 站点 JS想要互通,元素互相访问 调用,那么当前
A 站点页面:


B 站点 :

简单来说 就是用 反向代理站点 http://127.0.0.1:8081 来访问 A站点 和B 站点, 最终使它们显示在同一域名下,实现相互调用
ngix 反向代理配置:
server{ listen 8081; server_name 127.0.0.1; # 公网ip index index.php index.html index.htm; location / { proxy_pass http://127.0.0.1:8080; # 或 http://www.baidu.com proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #rewrite (.+) http://127.0.0.1:8080 permanent; } location /fqfqfq { proxy_pass http://127.0.0.1:8005/; # 或 http://www.baidu.com #proxy_set_header Host $proxy_host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #rewrite (.+) http://127.0.0.1:8005 permanent; } }
最终效果图:
