Skip to content

Commit

Permalink
doc(readme) add note for cosocket API availability in domain_whiltelist
Browse files Browse the repository at this point in the history
metamethod #9
  • Loading branch information
fffonion committed May 27, 2020
1 parent b132ced commit 998f218
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,29 @@ prevent potential abuse using fake SNI in SSL handshake.
domain_whitelist = { "domain1.com", "domain2.com", "domain3.com" },
```

To match a pattern in your domain name, for example all subdomains under `example.com`, use:
To match a pattern in your domain name, for example all subdomains under `example.com`, use:

```lua
domain_whitelist = setmetatable({}, { __index = function(_, k)
return ngx.re.match(k, [[\.example\.com$]], "jo")
end}),
```

Furthermore, since checking domain whitelist is running in certificate phase.
It's possible to use cosocket API here. Do note that this will increase the SSL handshake
latency.

```lua
domain_whitelist = setmetatable({}, { __index = function(_, k)
-- send HTTP request
local http = require("resty.http")
local res, err = httpc:request_uri("http://example.com")
-- access the storage
local value, err = require("resty.acme.autossl").storage:get("key")
end}),
```


## tls-alpn-01 challenge

<details>
Expand Down

0 comments on commit 998f218

Please sign in to comment.