Nginx A/B testing

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-03-26T14:21:00Z Indexed on 2010/03/26 14:23 UTC
Read the original article Hit count: 567

Filed under:
|
|

Hey,

I'm trying to do A/B testing and I'm using Nginx fo this purpose. My Nginx config file looks like this:

events {
    worker_connections  1024;
}

error_log /usr/local/experiments/apps/reddit_test/error.log notice;

http {
    rewrite_log  on;

    server {
        listen 8081;
        access_log  /usr/local/experiments/apps/reddit_test/access.log combined;

        location / {
            if ($remote_addr ~ "[02468]$") { 
                rewrite ^(.+)$ /experiment$1 last; 
            }
            rewrite ^(.+)$ /main$1 last;
        }

        location /main {
            internal;
            proxy_pass http://www.reddit.com/r/lisp;
        }

        location /experiment {
            internal;
            proxy_pass http://www.reddit.com/r/haskell;
        }
    }
}

This is kind of working, but css and js files woon't load. Can anyone tell me what's wrong with this config file or what would be the right way to do it?

Thanks,

Alex

© Stack Overflow or respective owner

Related posts about nginx

Related posts about proxy