Auto redirect agent url to https

Is there a way to get a non SSL agent url to automatically redirect to SSL? Instead of getting the “HTTP not allowed” message…

figured it out:

defaults <- {
accessControl = true,
allowUnsecure = true,
strictRouting = false,
timeout = 10
}

api = Rocky(defaults);

That covers allowing HTTP in the first place. Do you have a snippet you could share that does the redirect-to-HTTPS bit?

Side note: we considered entirely disallowing HTTP (with a forced redirect) for the Electric Imp public cloud, but rejected it on the grounds of backwards compatibility (it’s entirely possible that some customers’ apps were written without HTTPS support). Private clouds are configured with HTTP disabled.