require "apache2" function redirect_ssl(r) if r.subprocess_env['SSL'] == nil then local URL = r:construct_url(r.uri) r.err_headers_out['Location'] = string.gsub(URL, "http://", "https://") return 302 end return apache2.DECLINED end