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

help request: accessing an HTTPS route I receive a LUA runtime error: "attempt to index local 'matched_ssl' (a nil value)" #10016

Closed
MirtoBusico opened this issue Aug 13, 2023 · 2 comments

Comments

@MirtoBusico
Copy link

Description

When I access an HTTPS route (in my example it is the bookinfo istio demo application) I receive in the browser the correct page but without any other element (css, icon, javascript...).

the error log

2023/08/13 17:34:42 [error] 49#49: *5083759 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:332: attempt to index local 'matched_ssl' (a nil value)
stack traceback:
coroutine 0:
 /usr/local/apisix/apisix/init.lua: in function 'verify_https_client'
 /usr/local/apisix/apisix/init.lua:560: in function 'http_access_phase'
 access_by_lua(nginx.conf:412):2: in main chunk, client: 127.0.0.6, server: _, request: "GET /static/bootstrap/css/bootstrap-theme.min.css HTTP/1.0", host: "h2serv.h.net", referrer: "https://h2serv.h.net/"
2023/08/13 17:34:42 [error] 52#52: *5083760 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:332: attempt to index local 'matched_ssl' (a nil value)
stack traceback:
coroutine 0:
 /usr/local/apisix/apisix/init.lua: in function 'verify_https_client'
 /usr/local/apisix/apisix/init.lua:560: in function 'http_access_phase'
 access_by_lua(nginx.conf:412):2: in main chunk, client: 127.0.0.6, server: _, request: "GET /static/bootstrap/css/bootstrap.min.css HTTP/1.0", host: "h2serv.h.net", referrer: "https://h2serv.h.net/"
2023/08/13 17:34:42 [error] 52#52: *5083763 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:332: attempt to index local 'matched_ssl' (a nil value)
stack traceback:
coroutine 0:
 /usr/local/apisix/apisix/init.lua: in function 'verify_https_client'
 /usr/local/apisix/apisix/init.lua:560: in function 'http_access_phase'
 access_by_lua(nginx.conf:412):2: in main chunk, client: 127.0.0.6, server: _, request: "GET /static/jquery.min.js HTTP/1.0", host: "h2serv.h.net", referrer: "https://h2serv.h.net/"
2023/08/13 17:34:42 [error] 52#52: *5083764 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:332: attempt to index local 'matched_ssl' (a nil value)
stack traceback:
coroutine 0:
 /usr/local/apisix/apisix/init.lua: in function 'verify_https_client'
 /usr/local/apisix/apisix/init.lua:560: in function 'http_access_phase'
 access_by_lua(nginx.conf:412):2: in main chunk, client: 127.0.0.6, server: _, request: "GET /static/bootstrap/js/bootstrap.min.js HTTP/1.0", host: "h2serv.h.net", referrer: "https://h2serv.h.net/"
2023/08/13 17:34:42 [error] 49#49: *5083775 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:332: attempt to index local 'matched_ssl' (a nil value)
stack traceback:
coroutine 0:
 /usr/local/apisix/apisix/init.lua: in function 'verify_https_client'
 /usr/local/apisix/apisix/init.lua:560: in function 'http_access_phase'
 access_by_lua(nginx.conf:412):2: in main chunk, client: 127.0.0.6, server: _, request: "GET /favicon.ico HTTP/1.0", host: "h2serv.h.net", referrer: "https://h2serv.h.net/"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET / HTTP/1.0" 200 1683 0.005 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" 10.43.225.130:9080 200 0.004 "http://h2serv.h.net"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET /static/bootstrap/css/bootstrap-theme.min.css HTTP/1.0" 500 651 0.000 "https://h2serv.h.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" - - - "http://h2serv.h.net"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET /favicon.ico HTTP/1.0" 500 651 0.000 "https://h2serv.h.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" - - - "http://h2serv.h.net"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET /static/bootstrap/css/bootstrap.min.css HTTP/1.0" 500 651 0.000 "https://h2serv.h.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" - - - "http://h2serv.h.net"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET /static/jquery.min.js HTTP/1.0" 500 651 0.000 "https://h2serv.h.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" - - - "http://h2serv.h.net"
127.0.0.6 - - [13/Aug/2023:17:34:42 +0000] h2serv.h.net "GET /static/bootstrap/js/bootstrap.min.js HTTP/1.0" 500 651 0.000 "https://h2serv.h.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" - - - "http://h2serv.h.net"

The SNI definition

sysop@h2dev:~$ curl http://localhost:8001/api/v1/namespaces/apisix/services/apisix-admin:9180/proxy/apisix/admin/ssls/2000 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1708    0  1708    0     0  81636      0 --:--:-- --:--:-- --:--:-- 85400
{
  "value": {
    "update_time": 1691923113,
    "snis": [
      "h2serv.h.net"
    ],
    "id": "2000",
    "status": 1,
    "cert": "-----BEGIN CERTIFICATE-----\nMIIEHDCCAwSgAwIBAgIUMSR6Br4CgtAhsqO0vQYLN9cU73EwDQYJKoZIhvcNAQEL\nBQAwgZUxCzAJBgNVBAYTAklUMQ4wDAYDVQQIDAVJdGFseTENMAsGA1UEBwwEUm9t\nZTEVMBMGA1UECgwMQnVzaW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GUJ8ngriZf34sAAxx3FVdClBXxBHaI5sqCFZt59UZFXUAvw\n9f3jPmuDUgACHsy4+uUql75iEFeH5p5wFIcPCURx2y/4jGtECIrMDZWCidmddObi\nEQyNUvBOL7+ibfuCgWQ3ZuZ2PCh4wLJo2vE3wgCQBtaA3+WvgX4/1viW3hpVLvYT\nt6IaR5BHuiv3uboMWe8JQAEUJgYYEh1LkIbapHPFSpe5iqtH88uVf4bIgdNH/DFm\n-----END CERTIFICATE-----\n",
    "create_time": 1691923113,
    "type": "server"
  },
  "createdIndex": 114,
  "key": "/apisix/ssls/2000",
  "modifiedIndex": 114
}
sysop@h2dev:~$ 

The upstream

sysop@h2dev:~$ curl http://localhost:8001/api/v1/namespaces/apisix/services/apisix-admin:9180/proxy/apisix/admin/upstreams/2000 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   427    0   427    0     0  28588      0 --:--:-- --:--:-- --:--:-- 30500
{
  "value": {
    "timeout": {
      "connect": 6,
      "send": 6,
      "read": 6
    },
    "keepalive_pool": {
      "idle_timeout": 60,
      "requests": 1000,
      "size": 320
    },
    "pass_host": "pass",
    "hash_on": "vars",
    "discovery_type": "dns",
    "update_time": 1691944127,
    "name": "productpage",
    "id": "2000",
    "service_name": "productpage.bookinfo.svc.cluster.local:9080",
    "scheme": "http",
    "create_time": 1691944109,
    "type": "roundrobin"
  },
  "createdIndex": 115,
  "key": "/apisix/upstreams/2000",
  "modifiedIndex": 116
}
sysop@h2dev:~$ 

The route

sysop@h2dev:~$ curl http://localhost:8001/api/v1/namespaces/apisix/services/apisix-admin:9180/proxy/apisix/admin/routes/2000 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   470    0   470    0     0  32116      0 --:--:-- --:--:-- --:--:-- 33571
{
  "value": {
    "desc": "h2serv.h.net primary route",
    "upstream_id": "2000",
    "host": "h2serv.h.net",
    "plugins": {
      "redirect": {
        "ret_code": 302,
        "encode_uri": false,
        "http_to_https": true,
        "append_query_string": false
      }
    },
    "update_time": 1691944589,
    "id": "2000",
    "status": 1,
    "name": "h2serv",
    "methods": [
      "GET",
      "POST",
      "PUT",
      "DELETE",
      "PATCH",
      "HEAD",
      "OPTIONS",
      "CONNECT",
      "TRACE",
      "PURGE"
    ],
    "priority": 0,
    "create_time": 1691944589,
    "uri": "/*"
  },
  "createdIndex": 119,
  "key": "/apisix/routes/2000",
  "modifiedIndex": 119
}
sysop@h2dev:~$ 

What I'm doing wrong?

Environment

  • APISIX version (run apisix version): 3.4.0
  • Operating system (run uname -a): Linux apisix-67f5f65695-dpz4p 6.1.0-10-amd64 change: added doc of how to load plugin. #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27) x86_64 GNU/Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V): nginx version: openresty/1.21.4.1
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@Revolyssup
Copy link
Contributor

@MirtoBusico This issue is already being tracked here #9610

@MirtoBusico
Copy link
Author

Thanks

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