Skip to content

Commit 9483ec4

Browse files
authored
Merge pull request #12 from Valian/extended-regex-support
extended regex support - using ngx.re.match instead of string.match
2 parents 19315b5 + ccfc25e commit 9483ec4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Available configuration options:
7171

7272
| Variable | Example | Description
7373
| --- | --- | ---|
74-
| ALLOWED_DOMAINS | `(www\|api).example.com`, `example.com`, `([a-z]+.)?example.com` | [lua pattern](http://lua-users.org/wiki/PatternsTutorial) of allowed domains. Internally, we're using `string.match`. By default we accept all domains |
74+
| ALLOWED_DOMAINS | `(www\|api).example.com`, `example.com`, `([a-z]+.)?example.com` | Regex pattern of allowed domains. Internally, we're using [ngx.re.match](https://github.com/openresty/lua-nginx-module#ngxrematch). By default we accept all domains |
7575
| DIFFIE_HELLMAN | `true` | Force regeneration of `dhparam.pem`. If not specified, default one is used. |
7676
| SITES | `db.com=localhost:5432; *.app.com=localhost:8080`, `_=localhost:8080` | Shortcut for defining multiple proxies, in form of `domain1=endpoint1; domain2=endpoint2`. Default template for proxy is [here](https://github.com/Valian/docker-nginx-auto-ssl/blob/master/snippets/server-proxy.conf). Name `_` means default server, just like in nginx configuration |
7777
| FORCE_HTTPS | `true`, `false` | If `true`, automatically adds location to `resty-server-http.conf` redirecting traffic from http to https. `true` by default. |

snippets/resty-http.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ init_by_lua_block {
2424
-- and register new certificates for. Defaults to not allowing any domains,
2525
-- so this must be configured.
2626
auto_ssl:set("allow_domain", function(domain)
27-
return string.match(domain, '$ALLOWED_DOMAINS')
27+
return ngx.re.match(domain, '$ALLOWED_DOMAINS', 'ijo')
2828
end)
2929

3030
auto_ssl:init()

0 commit comments

Comments
 (0)