Ruby on rails 如何在nginx中重写路径

Ruby on rails 如何在nginx中重写路径,ruby-on-rails,ruby-on-rails-4,nginx,web-config,cors,Ruby On Rails,Ruby On Rails 4,Nginx,Web Config,Cors,我有以下网址 http://localhost:3000/aws/abc/pqr/xyz/example.png 我想把它重定向到 https://s3.amazonaws.com/abc/pqr/xyz/example.png 我在nginx.conf中尝试了以下内容 location /aws { rewrite ^/aws/(.*) /$1 break; proxy_redirect off; proxy_pass https://s3.amazonaws

我有以下网址

http://localhost:3000/aws/abc/pqr/xyz/example.png
我想把它重定向到

https://s3.amazonaws.com/abc/pqr/xyz/example.png
我在nginx.conf中尝试了以下内容

location /aws {
  rewrite ^/aws/(.*) /$1 break;
  proxy_redirect off;        
  proxy_pass  https://s3.amazonaws.com;
  add_header 'Access-Control-Allow-Origin' '*';
}

您的重写语句中有一个输入错误。尝试:
rewrite^/aws/?(*)$/$1中断?很抱歉,这只是一个输入错误,我刚做了更改,但它仍然不起作用http://localhost:3000/aws/abc/pqr/xyz/example.png
仅限。我正在
img
tag中使用它&我的图像没有加载。事实上,我正在尝试这一点,因为我在加载图像时遇到了问题。你能发布完整的配置吗?你的重写语句中有一个输入错误。尝试:
rewrite^/aws/?(*)$/$1中断?很抱歉,这只是一个输入错误,我刚做了更改,但它仍然不起作用http://localhost:3000/aws/abc/pqr/xyz/example.png
仅限。我正在
img
tag中使用它&我的图像没有加载。事实上,我正在尝试这一点,因为我在加载图像时遇到了问题。你能发布完整的配置吗?