auto-ssl / auto-ssl/lua-resty-auto-ssl

Failing to use the 'has_certificate' method

Open
#283 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
2k
Forks
184
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/auto-ssl/lua-resty-auto-ssl#has_certificate) 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!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked has_certificate example and compare it with the OpenResty/nginx server block listening on port 80. Reproduce the reported rewrite_by_lua nil-method error and determine why the method is unavailable there; done means the certificate check works without that runtime error and supports the requested HTTP-to-HTTPS forwarding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.