'Proxypass based on port insert into the URL

I want to proxypass based on the port entered into the URL. if I enter https://example.com:8000/abc, then it should have to proxypass on http://127.0.0.1:8000/abc, if I enter https://example.com:5000/xyz then it should have to proxypass on http://127.0.0.1:5000/xyz , here abc and xyz can be anything.

I did tried to find solution on google, but didn't found proper one.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source