Score:1

How to make nginx use request port for try_files redirect?

jp flag

I have nginx listening on port 80 in a docker container which maps the port to 8080.

When I go to http://example.com:8080/test nginx redirects me to http://example.com/test/ while I would expect it to be http://example.com:8080/test/.

Nginx configuration:

server {
  listen 80;
  location /test {
    try_files $uri $uri/ /test.html;
  }
}

How do I make nginx use the request origin to make the redirect?

Score:1
jp flag

Using absolute_redirect off; solved the problem.

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.