node.js - Rewriting path with http-proxy-middleware -
trying rewrite path of request http-proxy-middleware. trouble when writing such code:
proxymiddleware('/service/api', {target: 'http://192.168.70.99:8078/'});
it means path /service/api/export/1 redirected http://192.168.70.99:8078/service/api/export/1; need redirect http://192.168.70.99:8078/export/1. how can that?
you can pass pathrewrite
opiton , inside use regex pattern remove path don't need:
proxymiddleware('/service/api', { target: 'http://192.168.70.99:8078/', pathrewrite: { '^/service/api':'' //remove /service/api } });
Comments
Post a Comment