I was able to fix this problem. <div><br></div><div>Amazon have some issues when using -website-us-east-1 so the only thing I had to do was remove that from the name of all the buckets and now it is working as it have to work. My vcl now is this:</div>
<div><br></div><div><div>backend app01 {</div><div> .host = "<a href="http://app01.site.com">app01.site.com</a>";</div><div> .port = "80";</div><div> .connect_timeout = 1.5s;</div><div> .first_byte_timeout = 45s;</div>
<div> .between_bytes_timeout = 30s;</div><div> .probe = {</div><div> .url = "/";</div><div> .interval = 5s;</div><div> .timeout = 1s;</div><div> .window = 5;</div><div> .threshold = 3;</div><div>
}</div><div>}</div><div><br></div><div>backend app02 {</div><div> .host = "<a href="http://app02.site.com">app02.site.com</a>";</div><div> .port = "80";</div><div> .connect_timeout = 1.5s;</div><div>
.first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 30s;</div><div> .probe = {</div><div> .url = "/";</div><div> .interval = 5s;</div><div> .timeout = 1s;</div><div> .window = 5;</div>
<div> .threshold = 3;</div><div> }</div><div>}</div><div><br></div><div>backend app03 {</div><div> .host = "<a href="http://app03.site.com">app03.site.com</a>";</div><div> .port = "80";</div><div>
.connect_timeout = 1.5s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 30s;</div><div> .probe = {</div><div> .url = "/";</div><div> .interval = 5s;</div><div> .timeout = 1s;</div>
<div> .window = 5;</div><div> .threshold = 3;</div><div> }</div><div>}</div><div><br></div><div>backend app04 {</div><div> .host = "<a href="http://app04.site.com">app04.site.com</a>";</div><div> .port = "80";</div>
<div> .connect_timeout = 1.5s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 30s;</div><div> .probe = {</div><div> .url = "/";</div><div> .interval = 5s;</div><div> .timeout = 1s;</div>
<div> .window = 5;</div><div> .threshold = 3;</div><div> }</div><div>}</div><div><br></div><div>backend app05 {</div><div> .host = "<a href="http://app05.site.com">app05.site.com</a>";</div><div> .port = "80";</div>
<div> .connect_timeout = 1.5s;</div><div> .first_byte_timeout = 45s;</div><div> .between_bytes_timeout = 30s;</div><div> .probe = {</div><div> .url = "/";</div><div> .interval = 5s;</div><div> .timeout = 1s;</div>
<div> .window = 5;</div><div> .threshold = 3;</div><div> }</div><div>}</div><div><br></div><div>director app_director round-robin {</div><div> { .backend = app01; }</div><div> { .backend = app02; }</div><div> { .backend = app03; }</div>
<div> { .backend = app04; }</div><div> { .backend = app05; } </div><div>}</div><div><br></div><div># Amazon S3 Backend site4</div><div># --</div><div>backend s3 {</div><div> .host = "<a href="http://site4.s3.amazonaws.com">site4.s3.amazonaws.com</a>";</div>
<div> .port = "80";</div><div>}</div><div><br></div><div># Amazon S3 Backend site3</div><div># --</div><div>backend s3sdr {</div><div> .host = "<a href="http://site3.s3.amazonaws.com">site3.s3.amazonaws.com</a>";</div>
<div> .port = "80";</div><div>}</div><div><br></div><div># Amazon S3 Backend site2</div><div># --</div><div>backend s3lvl {</div><div> .host = "<a href="http://site2.s3.amazonaws.com">site2.s3.amazonaws.com</a>";</div>
<div> .port = "80";</div><div>}</div><div><br></div><div># Amazon S3 Backend site1</div><div># --</div><div>backend s3gam {</div><div> .host = "<a href="http://site1.s3.amazonaws.com">site1.s3.amazonaws.com</a>";</div>
<div> .port = "80";</div><div>}</div><div><br></div><div>#acl internal {</div><div># "localhost";</div><div># "127.0.0.1";</div><div>#}</div><div><br></div><div>acl purge {</div><div> "localhost";</div>
<div> "192.168.11.0"/24;</div><div>}</div><div><br></div><div>sub vcl_recv {</div><div><br></div><div> if (req.request == "PURGE") {</div><div> if (!client.ip ~ purge) {</div><div> error 405 "Not allowed.";</div>
<div> }</div><div> ban("req.url = " + req.url);</div><div> return (lookup);</div><div> }</div><div><br></div><div> set req.backend = app_director;</div><div> # Peticion a site4</div><div> if (req.http.Host == "<a href="http://s3.site4.site.com">s3.site4.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> unset req.http.cookie;</div><div> unset req.http.cache-control;</div><div> unset req.http.pragma;</div><div> unset req.http.expires;</div><div> unset req.http.etag;</div><div> unset req.http.X-Forwarded-For;</div>
<div><br></div><div> set req.backend = s3;</div><div> set req.http.host = "<a href="http://site4.s3.amazonaws.com">site4.s3.amazonaws.com</a>";</div><div><br></div><div> return (lookup); </div><div> }</div>
<div> </div><div> #Peticion a site3</div><div> if (req.http.Host == "<a href="http://s3.site3.site.com">s3.site3.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> unset req.http.cookie;</div><div> unset req.http.cache-control;</div><div> unset req.http.pragma;</div><div> unset req.http.expires;</div><div> unset req.http.etag;</div><div> unset req.http.X-Forwarded-For;</div>
<div><br></div><div> set req.backend = s3sdr;</div><div> set req.http.host = "<a href="http://site3.s3.amazonaws.com">site3.s3.amazonaws.com</a>";</div><div><br></div><div> return (lookup); </div><div>
}</div>
<div><br></div><div> #Peticion a site2</div><div> if (req.http.Host == "<a href="http://s3.site2.site.com">s3.site2.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> unset req.http.cookie;</div><div> unset req.http.cache-control;</div><div> unset req.http.pragma;</div><div> unset req.http.expires;</div><div> unset req.http.etag;</div><div> unset req.http.X-Forwarded-For;</div>
<div><br></div><div> set req.backend = s3lvl;</div><div> set req.http.host = "<a href="http://site2.s3.amazonaws.com">site2.s3.amazonaws.com</a>";</div><div><br></div><div> return (lookup); </div><div>
}</div>
<div><br></div><div> #Peticion a site1</div><div> if (req.http.Host == "<a href="http://s3.site1.site.com">s3.site1.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> unset req.http.cookie;</div><div> unset req.http.cache-control;</div><div> unset req.http.pragma;</div><div> unset req.http.expires;</div><div> unset req.http.etag;</div><div> unset req.http.X-Forwarded-For;</div>
<div><br></div><div> set req.backend = s3gam;</div><div> set req.http.host = "<a href="http://site1.s3.amazonaws.com">site1.s3.amazonaws.com</a>";</div><div><br></div><div> return (lookup); </div><div>
}</div>
<div><br></div><div> # Use anonymous, cached pages if all backends are down.</div><div> if (! req.backend.healthy) {</div><div> unset req.http.Cookie;</div><div> set req.grace = 1h;</div><div> } else {</div><div>
set req.grace = 30s;</div><div> }</div><div><br></div><div> # Add the X-Forwarded-For header</div><div> # --</div><div> if (req.restarts == 0) {</div><div> if (req.http.x-forwarded-for) {</div><div> set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;</div>
<div> } else {</div><div> set req.http.X-Forwarded-For = client.ip;</div><div> }</div><div> }</div><div><br></div><div> # Sanely handle the request based on the type</div><div> # --</div><div> if (req.request != "GET" &&</div>
<div> req.request != "HEAD" &&</div><div> req.request != "PUT" &&</div><div> req.request != "POST" &&</div><div> req.request != "TRACE" &&</div>
<div> req.request != "OPTIONS" &&</div><div> req.request != "DELETE") {</div><div> /* Non-RFC2616 or CONNECT which is weird. */</div><div> return (pipe);</div><div> }</div><div><br>
</div>
<div> # Request by post needs no cache</div><div> # --</div><div> if (req.request == "POST") {</div><div> return (pass);</div><div> }</div><div><br></div><div> # Admin needs no cache</div><div> # --</div>
<div> if (req.http.Host ~ "(?i)^(admin.)?<a href="http://site.com">site.com</a>") {</div><div> return (pass);</div><div> }</div><div><br></div><div> </div><div> # Always cache the following file types for all users.</div>
<div> if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|flv|avi|mov|wmv|css|js|html|htm)(\?[a-z0-9]+)?$") {</div><div> unset req.http.Cookie;</div><div> return (lookup);</div><div> }</div><div><br></div><div>
# Login and logout needs no cache</div><div> # --</div><div> if (req.url ~ "^/usuario/salir" || req.url ~ "^/usuario/redirectWindow" || req.url ~ "^/usuario/al") { </div><div> return (pass);</div>
<div> }</div><div> </div><div> # No save at cache the user profile</div><div> if (req.url ~ "^/usuario/([0-9]+)/(.*?)/") {</div><div> return (pass);</div><div> }</div><div><br></div><div> # Requests to /no-cache/ needs no cache</div>
<div> # --</div><div> if (req.request == "GET" && req.url ~ "^/no-cache") {</div><div> return (pass);</div><div> }</div><div> if (req.request == "GET" && req.url ~ "^/rss/") {</div>
<div> return (pass);</div><div> }</div><div><br></div><div> # Not sure what could match here, but it's in the default.vcl</div><div> # --</div><div> if (req.request != "GET" && req.request != "HEAD") {</div>
<div> /* We only deal with GET and HEAD by default */</div><div> return (pass);</div><div> }</div><div><br></div><div> # Handle compression correctly. Different browsers send different</div><div> # "Accept-Encoding" headers, even though they mostly all support the same</div>
<div> # compression mechanisms. By consolidating these compression headers into</div><div> # a consistent format, we can reduce the size of the cache and get more hits.=</div><div> # @see: http:// <a href="http://varnish.projects.linpro.no/wiki/FAQ/Compression">varnish.projects.linpro.no/wiki/FAQ/Compression</a></div>
<div> if (req.http.Accept-Encoding) {</div><div> if (req.http.Accept-Encoding ~ "gzip") {</div><div> # If the browser supports it, we'll use gzip.</div><div> set req.http.Accept-Encoding = "gzip";</div>
<div> }</div><div> else if (req.http.Accept-Encoding ~ "deflate") {</div><div> # Next, try deflate if it is supported.</div><div> set req.http.Accept-Encoding = "deflate";</div><div> }</div>
<div> else {</div><div> # Unknown algorithm. Remove it and send unencoded.</div><div> unset req.http.Accept-Encoding;</div><div> }</div><div> }</div><div><br></div><div> # Cache all requests by default, overriding the standard Varnish behavior</div>
<div> if (req.request == "GET" || req.request == "HEAD") {</div><div> /* We only deal with GET and HEAD by default */</div><div> #unset req.http.Cookie;</div><div> return (lookup);</div><div>
}</div><div><br></div><div> # If there's a cookie left aft this point do not cache</div><div> # or is this easier to keep in the cookie deletion above?</div><div> # --</div><div> if (req.http.Authorization || req.http.Cookie) {</div>
<div> /* Not cacheable by default */</div><div> return (pass);</div><div> }</div><div><br></div><div> # If we get here, try the cache</div><div> # --</div><div> return (lookup);</div><div><br></div><div>}</div>
<div>
<br></div><div>sub vcl_pipe {</div><div> return (pipe);</div><div>}</div><div><br></div><div>sub vcl_pass {</div><div> return (pass);</div><div>}</div><div><br></div><div>sub vcl_hash {</div><div> # Include cookie in cache hash.</div>
<div> # This check is unnecessary because we already pass on all cookies.</div><div> #if (req.http.Cookie) {</div><div> # #set req.hash += req.http.Cookie;</div><div> # hash_data(req.http.Cookie);</div><div> #}</div>
<div>}</div><div><br></div><div>sub vcl_hit {</div><div> if (req.request == "PURGE") {</div><div> purge;</div><div> error 200 "Purged";</div><div> }</div><div>}</div><div><br></div><div>sub vcl_miss {</div>
<div> if (req.request == "PURGE") {</div><div> purge;</div><div> error 200 "Purged";</div><div> }</div><div>}</div><div><br></div><div>sub vcl_fetch {</div><div><br></div><div> # S3 Site4</div>
<div> # --</div><div> if (req.http.Host == "<a href="http://s3.site4.site.com">s3.site4.site.com</a>" && req.url ~ "\.(flv|mp4|jpg)(\?[a-z0-9]+)$") {</div><div> remove beresp.http.x-amz-id-2;</div>
<div> remove beresp.http.x-amz-request-id;</div><div><br></div><div> set beresp.ttl = 1w;</div><div> set beresp.grace = 30s;</div><div> </div><div> if (beresp.status != 200) {</div><div> return (error);</div>
<div> }</div><div> }</div><div><br></div><div> # S3 Site3</div><div> # --</div><div> if (req.http.Host == "<a href="http://s3.site3.site.com">s3.site3.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> remove beresp.http.x-amz-id-2;</div><div> remove beresp.http.x-amz-request-id;</div><div><br></div><div> set beresp.ttl = 1w;</div><div> set beresp.grace = 30s;</div><div> </div><div> if (beresp.status != 200) {</div>
<div> return (error);</div><div> }</div><div> }</div><div><br></div><div> # S3 site2</div><div> # --</div><div> if (req.http.Host == "<a href="http://s3.site2.site.com">s3.site2.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> remove beresp.http.x-amz-id-2;</div><div> remove beresp.http.x-amz-request-id;</div><div><br></div><div> set beresp.ttl = 1w;</div><div> set beresp.grace = 30s;</div><div> </div><div> if (beresp.status != 200) {</div>
<div> return (error);</div><div> }</div><div> }</div><div><br></div><div> # S3 site1</div><div> # --</div><div> if (req.http.Host == "<a href="http://s3.site1.site.com">s3.site1.site.com</a>" && req.url ~ "\.(flv|mp4|jpg|xml|png|gif)(\?[a-z0-9]+)$") {</div>
<div> remove beresp.http.x-amz-id-2;</div><div> remove beresp.http.x-amz-request-id;</div><div><br></div><div> set beresp.ttl = 1w;</div><div> set beresp.grace = 30s;</div><div> </div><div> if (beresp.status != 200) {</div>
<div> return (error);</div><div> }</div><div> }</div><div><br></div><div> # remove all cookies</div><div> # unset beresp.http.set-cookie;</div><div><br></div><div> # cache for 12 hours</div><div> # set beresp.ttl = 2h;</div>
<div><br></div><div> # Don't allow static files to set cookies.</div><div> if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm|mp4|flv)(\?[a-z0-9]+)?$") {</div><div> unset beresp.http.set-cookie;</div>
<div> set beresp.ttl = 12h;</div><div> } else {</div><div> set beresp.ttl = 30m;</div><div> }</div><div><br></div><div> # If the backend server doesn't return properly, don't send another connection to it</div>
<div> # for 60s and try another backend via restart.</div><div> #</div><div> # <a href="https://www.varnish-cache.org/docs/trunk/tutorial/handling_misbehaving_servers.html">https://www.varnish-cache.org/docs/trunk/tutorial/handling_misbehaving_servers.html</a></div>
<div> # --</div><div> if(beresp.status == 500 || beresp.status == 503) {</div><div> if (req.restarts > 3) {</div><div> set beresp.saintmode = 5m;</div><div> }</div><div> if (req.request != "POST") {</div>
<div> return(restart);</div><div> } else {</div><div> error 500 "Failed";</div><div> }</div><div> }</div><div><br></div><div> # Allow items to be stale if needed.</div><div> set beresp.grace = 1h;</div>
<div><br></div><div>}</div><div><br></div><div>sub vcl_deliver {</div><div> # if (resp.http.magicmarker) {</div><div> # unset resp.http.magicmarker;</div><div> # set resp.http.age = "0";</div><div> # }</div>
<div><br></div><div> if (obj.hits > 0) {</div><div> set resp.http.X-Cache = "HIT";</div><div> } else {</div><div> set resp.http.X-Cache = "MISS";</div><div> }</div><div> return (deliver);</div>
<div>}</div><div><br></div><div># In the event of an error, show friendlier messages.</div><div>sub vcl_error {</div><div> # Otherwise redirect to the homepage, which will likely be in the cache.</div><div> set obj.http.Content-Type = "text/html; charset=utf-8";</div>
<div> synthetic {"</div><div><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<a href="http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/loose.dtd</a>"></div>
<div>
<html></div><div><head></div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></div><div><title>..:: Site :: Por el momento estamos en mantenimiento</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>::..</title></div><div><br></div><div></head></div><div><body></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><div class="logo">En mantenimiento</div></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><div class="text">Estamos experimentando problemas. Vuelve</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>más tarde.</div></div>
<div> <div style="display:none;">(Error "} + obj.status + " " + obj.response + {")</div></div><div></body></div><div></html></div><div>"};</div><div> return (deliver);</div>
<div>}</div><div><br></div><div>sub vcl_init {</div><div> return (ok);</div><div>}</div><div><br></div><div>sub vcl_fini {</div><div> return (ok);</div><div>}</div><div><br></div><div><div class="gmail_quote">2012/6/28 Hugo Cisneiros (Eitch) <span dir="ltr"><<a href="mailto:hugo.cisneiros@gmail.com" target="_blank">hugo.cisneiros@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Jun 27, 2012 at 8:42 PM, Abraham Cruz Sustaita<br>
<<a href="mailto:abraham.sustaita@buscacorp.com">abraham.sustaita@buscacorp.com</a>> wrote:<br>
> I have this configuration:<br>
><br>
> # Amazon S3 Backend Metatube<br>
> # --<br>
> backend s3 {<br>
> .host = "<a href="http://metatube.s3-website-us-east-1.amazonaws.com" target="_blank">metatube.s3-website-us-east-1.amazonaws.com</a>";<br>
> .port = "80";<br>
> }<br>
><br>
> But the amazon url sometimes resolves to more of one IP (I guess is a normal<br>
> behaviour from Amazon), so I have to try several times to load the<br>
> configuration file (via varnishadm) until it compiles correctly. The problem<br>
> is I have a 5 different domains with amazon, so when finally one of them<br>
> resolves to just one IP, the others resolve to more than one, so I can never<br>
> compile the configuration file. Is there anyway to fix this via<br>
> configuration?<br>
<br>
</div></div>Currently varnish does not support multiple IPs on one backend.<br>
There's no easy and native way to do this. Please see the mailing list<br>
archives for many discussions and some approaches about this issue :)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
[]'s<br>
Hugo<br>
<a href="http://www.devin.com.br" target="_blank">www.devin.com.br</a><br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</font></span></blockquote></div><br></div></div>