Friday, November 3, 2017

Nginx rewrite prevent redirection

I am trying to make a url rewrite as following:



 location /statics/ {

alias /var/project/statics/;
}
location /statics/cache {
rewrite /statics/cache/(.*?)/(.*)$ http://$host/statics/$2 last;
}


Where URL would be as:
http://ANY-DOMAIN.com/statics/cache/1.2.5/file/path/file.js
The original file is:
http://ANY-DOMAIN.com/statics/file/path/file.js



The problem here is:

URL is redirecting (changing URL) to original file. I want to prevent the redirection.



Current status:
Redirects to original URL

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...