如何在Xampp中设置代理

时间:2018-07-10 08:20:22

标签: php angular proxy xampp

我顺口溜

http://localhost:4200/login

php在

中运行
http://127.0.0.1/trunk/server/

在这样的请求响应过程中出现错误:

Failed to load http://127.0.0.1/trunk/server/login: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

我像这样在httpd-vhosts.conf中创建了一个代理:

<VirtualHost *:80>
ServerName localhost
ProxyPreserveHost on
ProxyPass /wms http://localhost:4200
ProxyPassReverse /wms http://localhost:4200
</VirtualHost>

我也尝试过在角度使用proxy.config.json也不起作用。

任何解决方案。

0 个答案:

没有答案