我正在开发一个应用程序使用烬-cli,它需要发送http请求到服务器使用ProxyPass。
我的服务器如下所示:subdomain.domain.com/api/client/user和Ember-cli缺省情况下创建http://localhost:4200/
我试图在我的http.conf中这样做:
ProxyPass /api/clients http://subdomain.domain.com/api/clients这对于http://localhost/api/clients来说很好,但我不知道如何使它与非标准端口(如4200 )一起工作。
我也尝试创建一个virtualHost,但是它是相同的:
<VirtualHost *:4200>
ProxyPass /api/clients http://subdomain.domain.com/api/clients
</VirtualHost>我怎么能这么做?
编辑:我的RESTAdapter设置如下:
var ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api/clients'
});发布于 2015-05-21 17:26:23
在开发过程中,您应该使用http代理生成器来创建API的路径。ember help generate列出了语法:
http-proxy <local-path> <remote-url>
Generates a relative proxy to another server.这将生成一个代理,该代理只存在于开发期间(在/server/proxies/中),并且不会在生产构建中编译。根据您在上面提供的内容,这可能是您要寻找的内容:
ember generate http-proxy api http://subdomain.domain.com烬使用节点-http-代理来创建代理,因此您可以在必要时使用该文档对其进行更多的自定义。
https://stackoverflow.com/questions/30380003
复制相似问题