Score:0

Use URLs with special characters in nginx maps

br flag

I'm trying to setup a redirect system with nginx (somthing like aka.ms, aka.ms/terminal-docs = documentation of Windows Terminal). I created a file with a map that look like this:

map $request_uri $redirect_uri{
        [...]
        /youtube        https://www.youtube.com/channel/[...];
        [...]
}

Then i tried to add a /odysee link in the following way:

/odysee https://odysee.com/$/invite/@[...]:4;

But when reloading nginx it fail

# systemctl reload nginx
Job for nginx.service failed.
See "systemctl status nginx.service" and "journalctl -xe" for details.

I am thinking it fails because of the $ in Odysee's URL but i can't find a way to tell nginx to ignore the character

Richard Smith avatar
jp flag
The dollar literal is being interpreted as a variable name. There is a creative solution [here](https://stackoverflow.com/questions/57466554/how-do-i-escape-in-nginx-variables) that might help you.
us flag
BTW, `nginx -t` is a good way to check what exactly are the errors.
Michael Hampton avatar
cz flag
Seriously, again, run `nginx -t` and post the output.
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.