Ngnix newbie here. Please I need some help to figure out how to correctly make nginx modify and redirect (proxy?) incoming requests. The redirection seems to work ok, but the URL is not rewritten at the destination.
My configuration is:
server {
listen 91 default_server ssl;
ssl_prefer_server_ciphers on;
ssl_certificate /etc/nginx/ssl/domain.crt;
ssl_certificate_key /etc/nginx/ssl/domain.key;
location /dest {
rewrite ^a_service_prod&id_number=((1234701|1234708|1234802|1234808|1234812|1234902)\d+)&(.*?)$ /dest?service=a_service_prod.sub_service&operation=sub_service&id_number=$1&$2 break;
proxy_pass http://192.168.1.1:1440;
proxy_redirect off;
proxy_set_header Host $host;
}
}
Im trying to get requests such as /dest?service=a_service_prod&id_number=12347016734696&slime=somethig
to be rewritten and the request sent to another server as http://192.168.1.1:1440/dest?service=a_service_prod.sub_service&operation=sub_service&id_number=12347016734696&slime=somethig
But instead at the destination, what is received is http://192.168.1.1:1440/dest?service=a_service_prod&id_number=12347016734696&slime=somethig
Please what am I doing wrong, and how can I fix it?