Is it possible with nginx?

Maxim Dounin mdounin at mdounin.ru
Mon Feb 16 15:56:57 MSK 2009


Hello!

On Mon, Feb 16, 2009 at 12:59:34PM +0100, Peter Vage wrote:

> Igor Sysoev wrote:
> > On Mon, Feb 16, 2009 at 10:33:07AM +0100, Peter Vage wrote:
> > 
> >> 
> >> in my config in proxy_pass was web1.com not web1.http
> >> 
> >> proxy_pass http://$host_without_files; #!!!! DOESN'T WORK, 502 Bad 
> >> Gateway, if i type here http://web1.com then it works
> > 
> > Have you tried
> > 
> >    proxy_pass http://$host_without_files.com$request_uri;
> > 
> > ?
> 
> Yes I have website http://web1.com/image.jpg
> I go to http://web1.com.files.com/image.jpg
> 
> I am using
>   if ($host ~* "(.*)\.files\.com" ) {
>   set $host_without_files $1;
>   }
> 
> proxy_pass http://web1.com; #works, cache file is under 
> /web1.com/image.jpg
> proxy_pass http://host_without_files; # not work, 502 Bad Gateway
> proxy_pass http://host_without_files$request_uri; # not work, 502 Bad 
> Gateway
> proxy_pass http://host_without_files.com$request_uri; # not work, 502 
> Bad Gateway, why .com is before $request_uri

At least, you forgot '$' before host_without_files here.

> I would be better when it catch any websites before files.com, but then 
> i can't control who use it, and as said Maxim it could use more cpu.
> 
> I did as say Maxim, but it is question why it don't work, I am using 
> 0.7.24, i see that Coral Content Delivery Network use the same version. 

0.7.24 is a bit old, but it should work regardless.

Probably you have no resolver defined (and no matching upstream{} 
blocks).  Try looking into error_log, it has something for you.  
If it doesn't help - try tcpdump to find out what's happending on 
the wire.

Maxim Dounin

> They response header is:
> 
> Server: nginx/0.7.24
> Date: Mon, 16 Feb 2009 12:59:27 GMT
> Content-Type: image/jpeg
> Content-Length: 66965
> Last-Modified: Mon, 09 Feb 2009 18:14:52 GMT
> Connection: close
> Accept-Ranges: none
> Via: HTTP/1.0 193.63.75.21:8080 (CoralWebPrx/0.1.19 (See 
> http://coralcdn.org/))
> Cache-Control: max-age=2595698
> Expires: Wed, 18 Mar 2009 12:59:27 GMT
> 
> 200 OK
> 
> Regards,
> Peter
> -- 
> Posted via http://www.ruby-forum.com/.
> 





More information about the nginx mailing list