public-access-proxy: fix wildcard matches
This commit is contained in:
parent
b1ae3b6013
commit
dbccd2df17
|
@ -3,6 +3,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
let cfg = config.my.services.proxy;
|
let cfg = config.my.services.proxy;
|
||||||
|
|
||||||
|
withoutWildcards = builtins.replaceStrings ["*"] ["all"];
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options.my.services.proxy = {
|
options.my.services.proxy = {
|
||||||
|
@ -98,8 +100,8 @@ in {
|
||||||
optionalString
|
optionalString
|
||||||
(proxyHost.hostNames != [ ] && proxyHost.proxyTo.host != null)
|
(proxyHost.hostNames != [ ] && proxyHost.proxyTo.host != null)
|
||||||
(concatMapStringsSep "\n" (hostname: ''
|
(concatMapStringsSep "\n" (hostname: ''
|
||||||
use-server ${hostname}-http if { req.hdr(host) -i ${hostname} }
|
use-server ${withoutWildcards hostname}-http if { req.hdr(host) -i ${hostname} }
|
||||||
server ${hostname}-http ${proxyHost.proxyTo.host}:${
|
server ${withoutWildcards hostname}-http ${proxyHost.proxyTo.host}:${
|
||||||
toString proxyHost.proxyTo.httpPort
|
toString proxyHost.proxyTo.httpPort
|
||||||
} weight 0
|
} weight 0
|
||||||
'') (proxyHost.hostNames))) (cfg.proxyHosts)
|
'') (proxyHost.hostNames))) (cfg.proxyHosts)
|
||||||
|
@ -117,8 +119,8 @@ in {
|
||||||
optionalString
|
optionalString
|
||||||
(proxyHost.hostNames != [ ] && proxyHost.proxyTo.host != null)
|
(proxyHost.hostNames != [ ] && proxyHost.proxyTo.host != null)
|
||||||
(concatMapStringsSep "\n" (hostname: ''
|
(concatMapStringsSep "\n" (hostname: ''
|
||||||
use-server ${hostname}-https if { req.ssl_sni -i ${hostname} }
|
use-server ${withoutWildcards hostname}-https if { req.ssl_sni -i ${hostname} }
|
||||||
server ${hostname}-https ${proxyHost.proxyTo.host}:${
|
server ${withoutWildcards hostname}-https ${proxyHost.proxyTo.host}:${
|
||||||
toString proxyHost.proxyTo.httpsPort
|
toString proxyHost.proxyTo.httpsPort
|
||||||
} weight 0
|
} weight 0
|
||||||
'') (proxyHost.hostNames))) (cfg.proxyHosts)
|
'') (proxyHost.hostNames))) (cfg.proxyHosts)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user