Implement Allow-Methods and Allow-Headers, refactor isOriginAllowed