Search code examples
nginxamazon-s3

no resolver defined to resolve s3-eu-west-1.amazonaws.com


All my xml files are stored in a AWS S3, I want to show them via my website :

Nginx conf:

location ~ \.xml$ {

    proxy_pass https://s3-eu-west-1.amazonaws.com/bucket-name/sitemap$request_uri;

}

But I get a 502 and log says

[error] 13295#13295: *26 no resolver defined to resolve s3-eu-west-1.amazonaws.com

If I define a resolver like

resolver s3-eu-west-1.amazonaws.com;

I get

[error] 14430#14430: *7 s3-eu-west-1.amazonaws.com could not be resolved (110: Operation timed out),

Thank you for helping


Solution

  • I found a solution:

    location ~ \.xml$ {
    
        rewrite ^ /<bucket>/sitemap$request_uri break;
        proxy_pass https://s3-eu-west-1.amazonaws.com;
    }