Help: [http-proxy-middleware] Reverse Proxy dealing with absolute urls

I’ve setup a proxy with http-proxy-middleware. Currently I have a server on port 3002 and 3001. The server on port 3002 uses urls like /js/somefile.js and /css/stylefile.css. Unfortunately my reverse proxy is set to use paths starting with /server1 and /server2, so any path not starting with one of those gets a 404. How can I automatically correct the wrong urls. I cannot modify the html files directly in this case because then the server will replace them on the next restart. I am thinking about guessing which server to route to based on the referer but I’m not very skilled with node and need help.
Thank you very much!
I’m also resorting to a unstable backup solution, filter out the html responses and replace the absolute urls.

I’m not sure actually how to implement my backup solution, I’ve googled and got nothing about finding absolute urls and modifying them.