Score:0

How to define a location by a string in URL using NGINX

fr flag

I have the URL:

https://mysitedomain:8443/app/visualize?security_tenant=global#/edit/9e5fc420-89cd-11ec-b13a-ddde90ebb494?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-1y%2Cto%3Anow))

I need to permit it go to the proxy_pass if the string "embed=true" are present in the URL.

I did alot of tries but no success, i think my regex is not working, I have try so many regexes that I am actually lost.

There is my configuration:

    location ~ embed$ {

      proxy_set_header Accept-Encoding "";
      proxy_redirect off;
      proxy_buffering off;
      proxy_http_version 1.1;
      proxy_set_header Authorization "Basic YWRtaW46Y3WRaW4=";
      proxy_set_header Connection "Keep-Alive";
      proxy_set_header Proxy-Connection "Keep-Alive";
      proxy_pass https://thesite;
   }

Looking at Debug of nginx, looks like nginx are not getting all the URL strings, and just the prefix of it:

2022/03/17 23:11:24 [debug] 35347#0: *1 http request line: "GET /app/visualize?security_tenant=global HTTP/1.1"
2022/03/17 23:11:24 [debug] 35347#0: *1 http uri: "/app/visualize"
2022/03/17 23:11:24 [debug] 35347#0: *1 http args: "security_tenant=global"
2022/03/17 23:11:24 [debug] 35347#0: *1 http exten: ""
dave_thompson_085 avatar
jp flag
**The part of a URL starting with # IS NOT SENT** by a client like a browser; see [wikipedia](https://en.wikipedia.org/wiki/URI_fragment) under Basics the third paragraph. If you want to send a query-parameter that includes a URL-special character like #, it must be [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding) like your %3A for colon and %2C for comma already are.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.