Skip to content

Configuration crash caused by a syntax error #5011

@sinisap-afk

Description

@sinisap-afk

Hi,
This is FYI only, you could possibly add more resilient code for custom location code check. I know there is a waring about own risk but still .....

I had a syntax problem (e.g. extra "}" at the end of lua block) in a custom location of a proxy host, which completely crashed the app, the conf file is not written, e.g. my 5.conf file disappeared.

After fixing the syntax all is back to normal, the lua block with syntax error in bold is below

Thanks for your great work

//
access_by_lua_block {
local openidc = require "resty.openidc"
local session_opts = {
cookie_secure = true,
cookie_http_only = true,
cookie_same_site = "Lax",
secret = "xxxxxxx"
}
local opts = {
redirect_uri = "https://xxxxxxx/oidc_callback",
ssl_verify = "no"
}
local res, err = openidc.authenticate(opts, nil, nil, session_opts)
if err then
ngx.status = 500
ngx.say("Callback error: " .. (err or "Unknown"))
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
-- Redirect back after successful auth
return ngx.redirect("/xxxxx")
}
}

//

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions