Project

General

Profile

AbsoLUAtion » http-opportunistic.lua

RFC 8164 Opportunistic Security for HTTP/2 - gstrauss, 2020-09-20 08:28

 
-- http-opportunistic.lua
--
-- Summary: sample script to respond to "/.well-known/http-opportunistic"
--
--
-- Copyright (c) 2020, Glenn Strauss (gstrauss () gluelogic.com), incremental
-- All rights reserved.
--
-- License: 3-clause BSD
--
--
-- lighttpd.conf
-- server.modules += ("mod_magnet")
-- $HTTP["url"] =~ "^/.well-known/" {
-- magnet.attract-raw-url-to = ( "/path/to/well-known.lua" )
-- }

-- RFC 8164 Opportunistic Security for HTTP/2
-- https://tools.ietf.org/html/rfc8164
-- reference:
-- HTTP Alternative Services
-- https://tools.ietf.org/html/rfc7838
if (lighty.env["uri.path"] == "/.well-known/http-opportunistic") then
lighty.header["Content-Type"] = "application/json"
lighty.content = { "[ \"http://www.example.com\", \"http://example.com\" ]" }
return 200
end

return 0
(3-3/6)