added functionality to handle public domain differences, tls, path rewriting, etc.