1
我尝试通过此article创建连接代理。在我的代码中,几乎所有内容都是相同的,但我需要通过https协议调用某些内容。Grunt连接代理重写不起作用在https
connect: {
options: {
port: 9000,
hostname: '0.0.0.0',
livereload: 35729
},
proxies: [{
context: ['/foo/product', '/foo/somethingelse'],
host: 'non-https-domain.com',
changeOrigin: true
rewrite: {
'^/foo': ''
}
},{
context: '/productImages',
host: 'https-domain.com',
https: true,
port: 443, // just trying
changeOrigin: true,
rewrite: {
'^/productImages': ''
}
}],
livereload: {
// the same like the article
}
}
的/product
和/somethingelse
效果很好,但/productImages
没有。
我需要调用它像这样:
localhost:9000/productImages/lot/of/directory/and/finally/a/file.jpg
,它应该叫
https://https-domain.com/lot/of/directory/and/finally/a/file.jpg
的一点是,没有/productImages
。但替换从未发生过。
在此先感谢您的帮助!
是否有错误?您是否使用自签名SSL证书? – mike 2014-09-23 13:49:32
没有错误,只是简单地调用了一个错误的url。我不使用自签名证书。 – kree 2014-09-23 13:51:37
我不是100%肯定的,但我相信你在尝试在本地主机上使用https时需要一个自签名证书......它在哪里失败? – mike 2014-09-23 13:55:01