basic rewrite question

halfpastjohn nginx-forum at forum.nginx.org
Wed Oct 18 15:39:22 UTC 2017


I'm trying to setup rewrites so I can automate this more efficiently. Some
of my locations require a rewrite and some do not. I currently have it
hardcoded into the proxy_pass:

location ~* /v1/device/(.*)/  {
    proxy_pass http://api.domain.com/api/v1.0/download/$1;
}


Would this accomplish the same thing?

location ~* /v1/device/(.*)/  {
    rewrite ^/(.*) /api/v1.0/download/$1 break;
    proxy_pass http://api.domain.com;
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276946,276946#msg-276946



More information about the nginx mailing list