Requests redirection not changing domain

I wish to create add-on that redirects users’ requests to some server but not showing this fact in address bar. For example, it could redirect request of example.com/ to localhost/?url=example.com.

The problem is as follows:

  • If I make add-on redirect user, address bar content is changed and displays the new URL. Also, domain is considered to be localhost, not example.com.
  • If I make add-on intercept (filter) requests, I can’t edit response headers so all HTML pages show up as text.
  • There isn’t proxy to which requests could be sent.

So, is there a way to redirect actual requests not changing user’s domain? Or there isn’t because of users’ security reasons?