使用webpack NPM和php服务器运行angular js(localhost:8080)
我希望从real domain运行npm服务器,就像我使用apache with php local.com一样,因为如果没有相同的URL,我无法测试API调用,因为您需要明确声明允许哪些代理访问不同源域上的资源 您的NPM服务器位于localhost:9080域上,它正在尝试访问localhost域上的资源。他们不匹配 最简单的方法是将PHP设置为发送标题:使用webpack NPM和php服务器运行angular js(localhost:8080),php,angularjs,apache,npm,Php,Angularjs,Apache,Npm,我希望从real domain运行npm服务器,就像我使用apache with php local.com一样,因为如果没有相同的URL,我无法测试API调用,因为您需要明确声明允许哪些代理访问不同源域上的资源 您的NPM服务器位于localhost:9080域上,它正在尝试访问localhost域上的资源。他们不匹配 最简单的方法是将PHP设置为发送标题: 访问控制允许原点:http://localhost:9080 这意味着localhost:9080域可以访问该资源 但是,不推荐在生产环
访问控制允许原点:http://localhost:9080
这意味着localhost:9080域可以访问该资源
但是,不推荐在生产环境中使用,如果这是您想要的体系结构,我建议您看看哪个体系结构可以让您拥有一个似乎可以代理您的NPM服务器的别名
Failed to load http://local.com/test.php: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:9080' is therefore not allowed access.