Welcome! Log In Create A New Profile

Advanced

Картинки из амазона

Алферов Василий
June 17, 2010 03:02AM
Держим у себя кастомный фронтэнд к твиттеру для наших пользователей.
Для того чтобы экономить траффик фетчим аватары с твиттера с помощью nginx.

Столкнулись с проблемой, некоторые сервера при запросе выдают ошибку.
Написал небольшой скрипт для проверки и вот что получилось:

Если запрашивать "GET
http://s.twimg.com/a/1276654401/images/default_profile_5_normal.pngHTTP/1.0",
то тот же сервер выдает все правильно.
При запросе на s.twimg.com "GET
/a/1276654401/images/default_profile_5_normal.png HTTP/1.0" выдает:

Server CloudFront
Via 1.0 8e9a4ae768e6927d3d01697a4e6e1232.cloudfront.net:11180(CloudFront)
Date Thu, 17 Jun 2010 05:53:39 GMT
Connection close
X-Amz-Cf-Id
be57b17fcc523c0a3ecef717959faf719e589d78aa7b3f47d993f880bd79dc49de6122e53df4a7bd
Content-Length 1222
Content-Type text/html
X-Cache Error from cloudfront
Expires Thu, 17 Jun 2010 05:53:39 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A
HREF="a/1276654401/images/default_profile_5_normal.png">a/1276654401/images/default_profile_5_normal.png</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Invalid URL
</STRONG>
</UL>

<P>
Some aspect of the requested URL is incorrect. Possible problems:
<UL>
<LI>Missing or incorrect access protocol (should be `http://'' or similar)
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:webmaster">webmaster</A>.

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Thu, 17 Jun 2010 05:53:39 GMT by cloudfront (CloudFront)
</ADDRESS>
</BODY></HTML>

Что странно, так себя ведут только некоторые сервера, на большинстве все ок.

Nginx посылает запросы, на которые выдается ошибка :(
Есть какой-нибудь способ изменить его поведение?

nginx version: nginx/0.7.65
Кусок конфига nginx:
------------------------
upstream twitter_upstream {
server s.twimg.com ;
server a1.twimg.com backup ;
}
------------------------
location /stwimg/ {
rewrite ^/stwimg/(.*)$ /$1 break;
root /var/www/twimg;
open_file_cache_errors off;
log_not_found off;
error_page 404 = /sfetch$uri;
}
location /sfetch/ {
internal;

rewrite ^/sfetch/(.*)$ /$1 break;
proxy_pass http://twitter_upstream;
open_file_cache_errors off;

proxy_set_header Host "s.twimg.com";

proxy_buffering on;
proxy_buffers 32 16k;

proxy_store on;
proxy_temp_path /var/www/tmp;
root /var/www/twimg;
}
------------------------
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Картинки из амазона

Алферов Василий June 17, 2010 03:02AM

Re: Картинки из амазона

Un Lexx June 17, 2010 06:54AM

Re: Картинки из амазона

Aleksandr Sytar June 17, 2010 07:16AM

Re: Картинки из амазона

Алферов Василий June 17, 2010 08:44AM

Re: Картинки из амазона

Igor Sysoev June 17, 2010 08:56AM

Re: Картинки из амазона

Алферов Василий June 17, 2010 09:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready