Customize Access-Control-Allow-Origin and fix some minor problems.

I would like to customize Access-Control-Allow-Origin header.

Thanks