How to skip remaining plugin 'access' phase execution and proxy to upstream?

I have two plugin A and B, the execution order is A -> B。

when executing the ‘access’ phase in plugin A, Is there some magic not to execute the ‘access’ phase of remaining plugins , just proxy to upstream? I don’t wonder to use global variable like ‘ngx.ctx.skip_plugin’.

Now, I use:

kong.service.set_upstream(“hostname”)
runloop.access.after(ngx.ctx)
return ngx.exit(ngx.OK)

in the plugin A ‘access’ phase and it works, skip plugin B ‘access’ phase and proxy to upstream. However, it use kong private method ‘runloop.access.after’.

Is there any better way to implement this logic?

Hi @xliuqq

Currently it is the best way to implement that logic.

In the future, the Plugin Development Kit will support this kind of functionality like skipping phases or returning content in the access phase in a cleaner way.