We can
redirect the request to another url in NGINX.
Example
location =
/image {
return 307
https://unsplash.com/photos/JrjhtBJ-pGU;
}
events { } http { include mime.types; server { listen 9090; server_name localhost; location = /image { return 307 https://unsplash.com/photos/JrjhtBJ-pGU; } } }
Validate
and reload nginx configuration file.
$sudo nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
$
$sudo nginx -s reload
Open the url 'http://localhost:9090/image', it will be redirected to the url mentioned in nginx.conf file.
No comments:
Post a Comment