Changes to support QA environment

1. disable ssl when port==80
2. prefer host from request['host'] over url.host