Say for example I have nginx proxy setup like such:
server {
listen 443 ssl;
server_name foo.com;
#SSL and logging settings omitted
location /datapath1 {
proxy_read_timeout 3500;
proxy_connect_timeout 3250;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:12345/;
}
location /datapath2 {
proxy_read_timeout 3500;
proxy_connect_timeout 3250;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:23456/;
}
}
The idea is that when this server receives POST requests to different data paths, the packets will be decrypted and sent to programs that run on the same machine, and response will be generated by the programs then encrypted and sent back to clients by nginx.
I know I can send HTTPS packets directly to the ports the programs are listening to...but I like this approach better because it hides the ports, and I do not need to mess around with caching and SSL in the programs, just let nginx handle them. Plus I more or less have to use a proxy server anyway...so I want to explore the possibility.
Will this work at all?