I am using NGINX as a proxy and my UI code is sending a payload
/?ddforward=https%3A%2F%2Frum.browser-intake-datadoghq.com%2Fapi%2Fv2%2Frum%3Fddsource%3Dbrowser%26ddtags%3Dsdk_version%253A4.24.1%252Cenv%253Astaging%252Cservice%253Acrestone-uat%252Cversion%253A4.1.3%252Cretry_count%253A183%252Cretry_after%253A500%26....
I have successfully been able to decode the URL but I am not able to decode the remaining URL (.com onwards) to go through the proxy.
This is the error that I am getting in my error.log when the request is sent:
[error] 1909930#1909930: *283 invalid port in upstream "https://rum.browser-intake-datadoghq.com%2Fapi%2Fv2%2Frum%3Fddsource%3Dbrowser%26ddtags%3Dsdk_version%253A4.24.1%252Cenv%253Astaging%252Cservice%253Acrestone-uat%252Cversion%253A4.1.3%252Cretry_count%253A183%252Cretry_after%253A500%26...
Here is my nginx config:
server {
listen 443 ssl http2;
add_header Access-Control-Allow-Origin * always;
add_header Allow 'GET, DELETE, HEAD, OPTIONS, POST' always;
location / {
error_log /var/log/nginx/error.log debug;
resolver 8.8.8.8 ipv6=off;
proxy_method 'POST';
if ($args ~ "ddforward=(.*?com)") {
set $ddforward $1;
}
if ( $ddforward ~ (.+)%3A%2F%2F(.+) ){ # fix :// between scheme and destination
set $ddforward $1://$2;
}
if ($args ~ \.com(.*)$) {
set $args_ddforward $1;
}
proxy_pass https://$ddforward$args_ddforward;
What can be done to decode the incoming $request_uri because it does not seem like nginx is doing this automatically. I apologize if my terminology is not correct, I am new to NGINX