All pastes #2092588 Raw Edit

Something

public text v1 · immutable
#2092588 ·published 2011-10-22 18:11 UTC
rendered paste body
<LuaHookTranslateName redirect_ssl>
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
</LuaHookTranslateName>