I administer website A that provides information for a number of users. Website B is an external website containing information that I would like to provide to the users of site A. Login credentials via basic HTTP authentication are required to access B. As the users of A do not know these login credentials, I am searching for a way to have the server of A (which I have full access to) acting like some sort of proxy between the users of site A and site B itself.

Here's how I imagine the sequence of actions:

  1. User X clicks a link on A, a new browser window (or tab) opens
  2. Server A logs in to B
  3. B is mirrored to the new tab on X's browser
  4. X is now seeing B as if he had logged in himself
  5. When X clicks a link on B, the HTTP request is not directly handled by B, instead A forwards the request to B and B's reply to X

The main goal is to enable the users to access B without having to know the login credentials. A nice extra would be if B would only see A's IP, not the user's IP.

Because information on B changes frequently, using a method similar to creating a snapshot of B that is hosted on A won't work even if that snapshot is created in regular intervals.


I have no access to B except for the frontend, thus I cannot change anything there. Information is indeed protected for a reason, but we are allowed to access this information. The problem is that some of my users seem to share the login credentials with their friends etc., so that's what I am trying to avoid.

Server A is running Apache with PHP 7.3.

I am no professional coder but having a basic understanding of how things work, so far I've been mostly able to help myself by reading the documentation. Therefore, a simple solution is not necessarily the main goal.

Edit 2:

I also have the option to set up a small server on our premises running a proxy (or anything else needed). However it will not be part of the internal network of neither A or B.

  • Presumably the content is password protected for a reason. Do you have permission to republish this content publicly? – Stephen Ostermiller Apr 4 at 17:21
  • You need to tell us what platform and web server you're using.as you may have different options depending on the platform. I.e., .NET vs PHP. Additionally, are you proficient as a coder or do you need something that doesn't require much coding. – Trebor Apr 4 at 19:49
  • What level of access to you have to B? Can you change the authentication parametera on B? – davidgo Apr 5 at 4:59
  • I have added the requested details. – sinth Apr 7 at 9:22
  • I'm guessing that there are other ways, but I've done this in the past in other languages via code with a HTTP request client. I.e, via code, I was able to simulate a browser request, retrieve the response and display it in the page I was managing. You might be able to do this via CURL, but I'm not proficient in PHP. Maybe try googling for HTTP client for PHP. You'll need to make sure the client support Basic Auth. – Trebor Apr 8 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.