我有一个Node.js(AngularJS应用程序)应用程序,它托管在localhost:9000 . 另一部分(遗留的 - GWT superdev模式 - JeTTy)托管在localhost:8888 .
我想配置http-proxy-middleware,以便将localhost:9000(NodeJS)中的任何内容重定向到localhost:8888(JeTTy),其中包含以下规范:(应用程序有3个 endpoints ):
https://localhost:9000/product -> http://127.0.0.1:8888/product
https://localhost:9000/servlets/my_servlet1 -> http://127.0.0.1:8888/servlets/my_servlet1
https://localhost:9000/admin -> http://127.0.0.1:8888/admin
var proxy = proxyMiddleware(['/product', '/admin', '/servlets'], {
target: 'http://127.0.0.1:8888',
changeOrigin: true,
xfwd: true
});
var app = connect();
app.use(proxy);
代理如下:
## node scripts/serve.js
[HPM] Proxy created: [ '/product, '/admin', '/servlets' ] -> http://127.0.0.1:8888
listening on port 9000
https://localhost:9000
现在我试图访问(通过localhost:9000) endpoints ,失败,http:500错误:
Request URL:https://localhost:9000/servlets/my_servlet1
Request Method:POST
Status Code:500 protocol = https host = null
Remote Address:[::1]:9000
HTTP ERROR 500
Problem accessing /servlets/my_servlet1. Reason:
protocol = https host = null
Powered by Jetty://
我在这里缺少什么?
提前致谢,
普拉迪普
1 回答
你能尝试使用http://localhost:9000而不是https://localhost:9000 . 您使用https的任何特定原因?