From TomMettam: Use the correct origin in the case of an SSL connection.