我有一个Node.js(AngularJS应用程序)应用程序,它托管在localhost:9000。另一部分(遗留的 - GWT superdev模式 - JeTTy)托管在localhost:8888。
我想配置http-proxy-middleware,以便将localhost:9000(NodeJS)中的任何内容重定向到localhost:8888(JeTTy),其中包含以下规范:(应用程序有3个端点):
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)端点,但失败了 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://
我在这里缺少什么?
先谢谢,
普拉迪普