strip white spaces in allowed referer

Equivalency to #159