How to configure apache/nginx to work as both proxy and rewrite?

Below is the desired goal:

  1. End user is redirected from my custom application to the DNS of Apache/Nginx with IP address as one of its query parameter.
  2. Apache/Nginx should redirect/proxypass the request to the IP address mentioned in query parameter.
  3. End user should only see the Apache/Nginx DNS and not the IP address in query parameter once the first response is received.

Example:

  1. user hits : https://:443/?host=172.13.70.32.
  2. Apache reads the "host" query parameter value and redirects/forwards the request to host value(172.13.70.32).
  3. For end user the URL is reconstructed and the query parameter (host) is removed so as to keep the IP hidden from end user once connection is established.

Below are the issue I am facing:

  1. I configured apache with rewrite rule but it exposes the end server to the user.
  2. I tried apache proxypass where the Apache DNS is only exposed throughout but the initial query parameter (host) remains as it is.

To summarize: I want a custom load balancer which will transfer my request to a specific target without exposing target IP. Target should be choose by load balancer dynamically based on query parameter or path of URL.

Any help will be appreciated. I am open to use some other services as well so please suggest any possible solution.

Regards,

Rahul Kumbhar



Read more here: https://stackoverflow.com/questions/67931318/how-to-configure-apache-nginx-to-work-as-both-proxy-and-rewrite

Content Attribution

This content was originally published by Rahul Kumbhar at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: