- local uri = ("%s/%s/"):format(fqdn, nonce)
- r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+ local nonce = publish(r.context_document_root, pattern)
+ if nonce == "" then
+ r:puts( "No links created" )
+ else
+ -- if FQDN override is set,
+ -- use override instead of my own server name and port number
+ local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
+ fqdn = fqdn or
+ (r.is_https and "https" or "http") ..
+ "://" .. r.server_name .. ":" ..r.port
+
+ local uri = ("%s/%s/"):format(fqdn, nonce)
+ r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+ end