2

Ich habe eine Node.js (AngularJS app) Anwendung, die auf lokale Host gehostet wird: 9000. Der andere Teil (Legacy One - GWT superdev mode - JeTTy) ist auf localhost: 8888 gehostet.http-Proxy-Middleware: Kann nicht localhost umleiten: 9000 bis localhost: 8888 von NodeJS zu JETTY

Ich möchte die http-Proxy-Middleware so konfigurieren, dass alles, was in localhost: 9000 (NodeJS) kommt, zu localhost: 8888 (JeTTy) mit den folgenden Spezifikationen umgeleitet wird: (Es gibt 3 Endpunkte der Anwendung) :

 
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 

http-proxy-middleware Die Einstellung ist wie folgt:

 

    var proxy = proxyMiddleware(['/product', '/admin', '/servlets'], { 
     target: 'http://127.0.0.1:8888', 
     changeOrigin: true, 
     xfwd: true 
    }); 
    var app = connect(); 
    app.use(proxy); 

Der Proxy ist wie folgt aufgebaut:

 
## node scripts/serve.js                                         
[HPM] Proxy created: [ '/product, '/admin', '/servlets' ] -> http://127.0.0.1:8888  
listening on port 9000                  
    https://localhost:9000  

Jetzt versuche ich, den Zugang zu (über localhost: 9000) die Endpunkte, scheiterte mit http: 500 Fehler:

 
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:// 

Was bin ich hier fehlt?

Vielen Dank im fortgeschrittenen,
Pradip

+0

Sollte es 'https: // localhost: 9000' oder nur' http: // localhost: 9000' sein? – kensplanet

Antwort

Verwandte Themen