http-proxy-middleware icon indicating copy to clipboard operation
http-proxy-middleware copied to clipboard

Intercept HTTP(s) calls and modify request "paths" on the fly

Open Zabrane opened this issue 2 years ago • 0 comments
trafficstars

Describe the feature you'd love to see

Hi @chimurai

I'm new to http-proxy-middleware and would like to know if it can help with my problem. Let's assume my browser tries to load this HTML page using GET:

GET https://abc.com/index.html \r\n

Is it possible to to intercept it, and instead make it look like this:

GET http://localhost:8080/https://abc.com/index.html 1.1 \r\n

Here, localhost:8080 is where my proxy is running.

Similarly, if the above HTML page contains an image (notice the relative URL of the image):

GET /images/profile.png  \r\n

that image must be intercepted and its path rewritten as:

GET http://localhost:8080/https://abc.com/images/profile.png  \r\n

The image has a relative URL which needs to be converted to an absolute one: . from: /images/profile.png . to: https://abc.com/images/profile.png . then finally rewritten as: http://localhost:8080/https://abc.com/images/profile.png

Can http-proxy-middleware be of any help here?

Thanks

Additional context (optional)

No response

Zabrane avatar Sep 18 '23 20:09 Zabrane