Cannot disable caching

Hello, I’ve been banging my head on this for a day now.

Nginx as caching frontend and Apache as backend on 127.0.0.1:8181.

How it’s supposed to be:

  1. /i/ is not passed, but served from FS
  2. /bsbs/ is passed with NO caching
  3. /torrent/ is passed with NO caching
  4. Everything else is passed WITH caching

What happens:

  1. /i/ is passed to Apache, but cached;
  2. /bsbs/ is cached;
  3. /torrent/ is NOT cached;
  4. Everything else is cached.
  5. Also requests to xxxx.com/bsbs (no end slash) get forwarded to
    xxxx.com:8181/bsbs

What am I doing wrong? Tanks in advance.

Server config:

proxy_cache_path /u02/nginx-cache-one levels=1:2
keys_zone=one:128m;
proxy_temp_path /u02/nginx-temp;

upstream realserver {
server 127.0.0.1:8181;
}

server {
listen 80;
server_name XXXX.com *.XXXX.com “”;

    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid    30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors   on;

location ^~ /i/ {
root /u01/web/XXXX.com/www-root/i;
access_log off;
expires 1d;
}

location ^~ /get/ {
proxy_pass http://realserver;
proxy_cache one;
proxy_cache_valid 30s;
}

location ^~ /torrent/ {
proxy_pass http://realserver;
proxy_cache off;
}

location ^~ /bsbs/ {
proxy_pass http://realserver;
proxy_cache off;
}

location / {
proxy_cache one;
proxy_cache_valid 2m;
proxy_pass http://realserver;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /u01/nginx/html;
}

location ~ /.ht {
deny all;
}

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,19479,19479#msg-19479