Web proxy URL rewriting port/pkg

Hi all, it's been a long time, and FreeBSD continues to serve my household very well.

I am wanting to try something, and am wondering if there is a port available that already does what I am looking for. I am wanting to deploy a web (forward) proxy, much like you find here at ProxySite, only I am wanting the URLs that are exchanged, to NOT work like this:

Clicked URL sent, from browser, to proxy:
URL received from proxy, to browser:

Instead I would like the URL transformation to be like this, for example:
URL between proxy and Internet:
URL between proxy and browser:

The objective is to have a web proxy with an appearance an functionality of ProxySite for example, but the URLs are not made obscure via the PHP process. Instead the 'inside' (browser to proxy) URLs exchanged are very much like the 'outside' (proxy to the 'www') except the domain name is really the piece that is transformed. Underneath, a whole lot of URL rewriting is going on, for each and every object, inserting my domain into the URL string, and converting the www site domain from using dots to dashes and making that the 'root' path to all the URLs for that web site.

I was looking at NGINX URL rewriting but I understand its a reverse proxy and not a forward proxy so am thinking I was looking down the wrong path.

Also, optional, it would be a great option, if I can configure cache control headers so that either (a) the original cache control headers are preserved, or (b) cache control headers variables could be manually set.

Does such a port/pkg already exist for FreeBSD that does it this way, or am I looking at having to do this from scratch? I got to believe this has already been done.

Hope all is well with everyone,
Hi all,

So there is no proxy available that does it this way? Or at least there is not port/pkg available for FreeBSD? I've been experimenting with some stuff and finding a forward proxy that does the transformations like I mentioned above would be the cat's meow. 🙃

Thanks again,
I did not understand exactly what you wanted to do so didn’t reply before but would relayd do what you want?

There is bound to be something but depends on what you are trying to achieve.
this type of stuff is frequently used in academia for scientific content access. the problem is not straightforward because of js and what not
also they are not free and closed source and have per publisher profiles which deal with all the quirks
if a site only has only relative urls then any reverse proxy will work (you dont need to rewrite anything in the retrieved documents)
you can try something like mod_sed for apache together with reverse proxy
if a site only has only relative urls then any reverse proxy will work (you dont need to rewrite anything in the retrieved documents)
you can try something like mod_sed for apache together with reverse proxy

I am looking to do URL transformation on a forward proxy, not reverse proxy. So on in other words, my client machines will use a browser to access the forward proxy web page (see above) and enter a site. Under the hood the forward proxy will convert the URL structure such that the public web site domain name is re-written from using dots to dashes, and becomes a the 'root' or the URL path for the client sessions; again see above.

But JavaScript would be an issue; I didn't think about that. I'm not a strong 'html' fellow by any stretch. Thanks for that.

Thanks all!
The only thing that seems to come close to what you're looking for is www/phproxy. But the project died many years ago.

It isn't simply rewriting the URL, there's an entire web application underneath that does the actual proxying. Which kind of makes me wonder what exactly you're trying to achieve? What's the purpose? You've only told us about some solution you're looking for but not why you think this will solve your issue or what the actual issue is that you're trying to solve.

This appears to have all the hallmarks of an XY problem.
Sorry SirDice,

The only problem I was trying to solve was an educational matter, can it be done, what would the outcome actually look like, etc. I've been playing around with some stuff for fun and education purposes. That's it.

Thanks everyone,