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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -