0

Using openidc module introspection under location and calling using below,

 Policy section
#
location = /_sample {
    internal;
    set $api_name "sample"; 
    access_by_lua_file /etc/nginx/path/oauth_introspection.lua;
     Proxypass......
}

Now i want to include below lua file to add some contents and validate something under the same request.

 Policy section
#
location = /_sample {
    internal;
    set $api_name "sample"; 
    access_by_lua_file /etc/nginx/path/oauth_introspection.lua;
        access_by_lua_file /etc/nginx/path/do_something.lua; //Error with duplicate
     Proxypass......
}

And my oauth_introspection.lua has this openidc introspect logic,

local res, err = require("resty.openidc").introspect(opts)
Satscreate
  • 305
  • 2
  • 16

1 Answers1

0

access_by_lua_file can be used only once. You must combine your code in lua file:

location = /_sample {
    internal;
    set $api_name "sample"; 
    access_by_lua_file /etc/nginx/path/action_sample.lua;
    Proxypass......
}

action_sample.lua:

local res, err = require("resty.openidc").introspect(opts)

-- do something or 
loadfile("/etc/nginx/path/do_something.lua")(opts)

Darius
  • 1,020
  • 1
  • 4
  • 16