Redirecting urls to a subdomain without http

Recently migrated a site onto Trellis/Bedrock/Roots. The legacy site was repointed to a subdomain and the previously existing SSL certs were also moved over. A number of client specific portals remain on the legacy system, which is no longer running any pages via SSL. I created some nginx rewrites using the Trellis includes process so that users could still access secure portals via the same www urls they have bookmarked. The issue I’m having is that these redirects are all rewriting to https. I’m not sure if this is a Trellis configuration thing or just an error on my part in the rewrites. Syntax I’ve tried so far is:

location ~* ^/4-h-canada/?$ { rewrite ^ http://portal.nonprofitrisk.org/4-h-canada permanent; }

and

location ~* ^/4-h-canada/?$ { return 301 http://portal.nonprofitrisk.org/4-h-canada; }

The goal is to get to http://portal.nonprofitrisk.org/4-h-canada from all variants of nonprofitrisk.org/4-h-canada

Edit: This appears to only occur when the scheme is specified and no subdomain is specified. e.g. http://nonprofitrisk.org/gaig and https://nonprofitrisk.org/gaig redirect to the https subdomain https://portal.nonprofitrisk.org, whereas http://www.nonprofitrisk.org/gaig or just nonprofitrisk.org/gaig work fine. I’d appreciate any insight on this.

I’m assuming it’s an HSTS issue if you haven’t customized it. Trellis defaults to enable it since it’s better for security.

Docs here for more details: https://roots.io/trellis/docs/ssl/#hsts

You’ll want to disable it or at least the subdomains feature.