Streamline logic around mapping HTTP_HOST with config file

- Also removed some unused global variables