'Redirect Nginx path no another path?

I have a problem trying to redirect a URL. This is my fragment of configuration :

location /path1 {
        proxy_pass http://192.168.1.10/path2;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

I only get a 404 error, you know if this is possible?

Other cases works well like this:

location /path1 {
        proxy_pass http://192.168.1.10/path1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

regards!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source