PERF-8 Fix for cross-origin issues when switching from HTTP to HTTPS and back.