Project

General

Profile

AbsoLUAtion » http-opportunistic.lua

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

 
1
-- http-opportunistic.lua
2
--
3
-- Summary: sample script to respond to "/.well-known/http-opportunistic"
4
--
5
--
6
-- Copyright (c) 2020, Glenn Strauss (gstrauss () gluelogic.com), incremental
7
-- All rights reserved.
8
--
9
-- License: 3-clause BSD
10
--
11
--
12
-- lighttpd.conf
13
--   server.modules += ("mod_magnet")
14
--   $HTTP["url"] =~ "^/.well-known/" {
15
--     magnet.attract-raw-url-to = ( "/path/to/well-known.lua" )
16
--   }
17

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

    
29
return 0
(3-3/3)