We want to get an easier to use system than bit.ly
which doesn't support updating URL redirects. Our current idea is to use NGINX with its basic logging.
However, we also want to see if round robin redirects work (a la A/B testing) as we are using it for donations.
Here's our setup:
# Clone our repository
git clone https://gist.github.com/a26174b833b66d2ad05688dceee755c8.git gist-nginx-round-robin
cd gist-nginx-round-robin
# Launch a container via Docker with a bash shell
# DEV: We could replace this with Vagrant but this is lighter
./run.sh
# In this Docker container, run our bootstrap script
/docker/bootstrap.sh
# Request from our server
curl --include http://localhost:80/
# ...
# Location: http://paypal.me/twolfson
# or
# Location: http://flattr.com/twolfson
# View NGINX logs
cat /var/log/nginx/round-robin.access.log
# 127.0.0.1 - - [19/May/2016:09:31:03 +0000] "GET / HTTP/1.1" 301 193 "-" "curl/7.35.0" "-" "paypal"
# 127.0.0.1 - - [19/May/2016:09:31:04 +0000] "GET / HTTP/1.1" 301 193 "-" "curl/7.35.0" "-" "flattr"
# 127.0.0.1 - - [19/May/2016:09:31:04 +0000] "GET / HTTP/1.1" 301 193 "-" "curl/7.35.0" "-" "flattr"
# 127.0.0.1 - - [19/May/2016:09:31:05 +0000] "GET / HTTP/1.1" 301 193 "-" "curl/7.35.0" "-" "paypal"
To tear down the Docker container, stop and remove it via:
./rm.sh