Fix #833 - Set security headers on responses

Woooooooaaaaah. So much code. Sorry guys ;P