kongkong-plugin

How to change Kong realm name


Any Kong authentication plugin (key-auth, basic-auth) produces a response header "www-authenticate" with a realm="kong". Is there a way to change the value of realm to something that doesn't indicate which API gateway I'm using?

I read the docs of the authentication plugins but there is no config value for that.


Solution

  • Because I build my own docker image, I decided to patch the value directly in the source code. For anyone interested, here is the line in the Dockerfile:

    RUN cd / && find . -name "meta.lua" 2>/dev/null | xargs sed -i.lua 's/_NAME = "kong"/_NAME = "<my-own-realm-name>"/g'
    

    The command searches for the meta.lua file and replaces the value of the _NAME variable. Maybe it could be more elegant, but it fits my needs.