【发布时间】:2014-09-23 13:41:16
【问题描述】:
我尝试通过这个article 创建一个连接代理。我的代码中几乎所有内容都相同,但我需要通过 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 证书吗?
-
没有错误,只是简单的调用了一个错误的url。我不使用自签名证书。
-
我不是 100% 肯定的,但我相信您在尝试在 localhost 上使用 https 时需要一个自签名证书......它在哪里失败了?
-
它失败了https-domain.com/productImages/lot/of/directory/and/finally/a/…服务器接到了电话,但是
/productImages。 -
你试过不使用 https 吗?
标签: javascript angularjs proxy gruntjs grunt-connect-proxy