Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to use the 'has_certificate' method #283

Open
petitiaux opened this issue Oct 11, 2022 · 1 comment
Open

Failing to use the 'has_certificate' method #283

petitiaux opened this issue Oct 11, 2022 · 1 comment

Comments

@petitiaux
Copy link

I'm looking to forward http traffic to https, if there is a certificate found. We're using the has_certificate method for this. We've implemented the example code but nginx fails with the following log line:

lua entry thread aborted: runtime error: rewrite_by_lua(default.conf:34):2: attempt to call method 'has_certificate' (a nil value)

I've placed the code inside the server block listening on port 80.

Any help is greatly appreciated!

@acatalina
Copy link

acatalina commented Oct 24, 2022

I had the same issue. Not much inside that function:

 local storage = auto_ssl.storage
 local cert = storage:get_cert(domain)

-- check if cert exists then do...

for reference https://github.com/auto-ssl/lua-resty-auto-ssl/blob/71259605a3868b287ac0501d5850594b3f1b9cbb/lib/resty/auto-ssl/utils/has_certificate.lua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants