Fix URL substitution on reverse proxies

Closes #47.
Merge pull request #48 from piojo/reverse-proxy-fix

Fix URL substitution on reverse proxies