modified to check origin_https