代理 Url.htaccess

Proxy Url .htaccess

我在 Gchrome 控制台中遇到错误

XMLHttpRequest cannot load http://example.com:7070/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.

我可以访问 http-bind http://example.com:7070/ 下面是我的 .htaccess 文件

RewriteRule http-bind/ http://example.com:7070/

如何解决这个问题?

您要做的是反向代理。 http://example.com:7070/ 在技术上是另一个来源,因此无法加载。

你有几个选择。

  1. 在 apache 配置文件上配置反向代理,
  2. this
  3. 一样在 .htaccess 上实现它
  4. example.com:7070
  5. 上实施 CORS