Good morning everyone, I have a rather peculiar configuration that I can't run with Nginx.
The webserver is dedicated to this job and is invoked with a descriptive domain based on a location, and consequently it has to do a reverse proxy to the specific IP of a device that is in that determinate Store, using VPN. The networking part has already been implemented but unfortunately the device responds only in HTTP and is incompatible with the software that works in HTTPS, with this proxy server we would like to bypass the problem and create a kind of middleware that converts requests from HTTPS to HTTP, obviously using a wildcard certificate.
I'll get into practice with an example:
store21c.example.com -> 10.0.21.253
store21s.example.com -> 10.0.21.251
in practice nginx should read the domain part after store and before the dot, the numeric part corresponds to the 3rd entry of the IP of the device, while the letter if it is the device with final ip 253 or if it is final 251.
The result is to create 1 or 2 NGNIX configurations (avoiding making one per case) that respond to all the variables, and be ready for future stores. I remember that the server is internal and not reachable from the internet and only needs to reverse proxy to that specific IPs.
Now we had this configurations that work great, but is for only one device:
server_name store21c.example.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.0.21.253;
}
Thank you for your support and suggestions in advance, Max