@@ -113,19 +113,6 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
113
113
}
114
114
end
115
115
116
- -- Check to ensure the domain is one we allow for handling SSL.
117
- --
118
- -- Note: We perform this after the memory lookup, so more costly
119
- -- "allow_domain" lookups can be avoided for cached certs. However, we will
120
- -- perform this before the storage lookup, since the storage lookup could
121
- -- also be more costly (or blocking in the case of the file storage adapter).
122
- -- We may want to consider caching the results of allow_domain lookups
123
- -- (including negative caching or disallowed domains).
124
- local allow_domain = auto_ssl_instance :get (" allow_domain" )
125
- if not allow_domain (domain , auto_ssl_instance , ssl_options , false ) then
126
- return nil , " domain not allowed"
127
- end
128
-
129
116
-- Next, look for the certificate in permanent storage (which can be shared
130
117
-- across servers depending on the storage).
131
118
local storage = auto_ssl_instance .storage
@@ -140,6 +127,12 @@ local function get_cert_der(auto_ssl_instance, domain, ssl_options)
140
127
return cert_der
141
128
end
142
129
130
+ -- Check to ensure the domain is one we allow for handling SSL.
131
+ local allow_domain = auto_ssl_instance :get (" allow_domain" )
132
+ if not allow_domain (domain , auto_ssl_instance , ssl_options , false ) then
133
+ return nil , " domain not allowed"
134
+ end
135
+
143
136
-- Finally, issue a new certificate if one hasn't been found yet.
144
137
if not ssl_options or ssl_options [" generate_certs" ] ~= false then
145
138
cert = issue_cert (auto_ssl_instance , storage , domain )
0 commit comments