0

I need to add a string to a URL to make nginx show the content properly. I have no idea why it won't show it properly without, but I've found out that adding &SpecialSauce=true to the URL makes it work through nginx.

But I only want to add it for specific url, not for everything.

I've tried this config

location / {
  proxy_pass http://internal_servername;
  proxy_set_header Host FQDN;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
  rewrite ^/sub1/sub2/test.aspx* /sub1/sub2/test.aspx$1&SpecialSauce=true break;
}

The request from the browser looks like this:

https://FQDN/sub1/sub2/test.aspx?i=CODE&id=1FAA17309C5C45E38D5195AAE644D5F2

When I try the URL I get a '404 - File or directory not found."

I also tried this rewrite just to test: rewrite ^([^.]*[^/])$ $1&SpecialSauce=true break;

Last thing I tried was this:

location /sub1/sub2/test.aspx {
  proxy_set_header Host FQDN;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
  return http://internal_servername$request_uri&SpecialSauce=true;
}```

0 Answers0