With "modifier/lua-backend"you can modify the internal KrakenD request before reaching a particular backend and change its response BEFORE is passed for the merge of backends at the endpoint level.Proxy (at backend’s extra_config): Communication between KrakenD and your services.With "modifier/lua-proxy"you can modify the internal KrakenD request before reaching all backends in the endpoint and modify the response AFTER the merge of all backends.However, KrakenD has not converted the request into an internal request just yet. With "modifier/lua-endpoint"you can modify the HTTP request context early in the transport layer.You can inspect and modify the request of the user. Router (at endpoint’s extra_config or service level): Communication between the end-user and KrakenD.These two places have the following considerations: When running Lua scripts, you can place them at the proxy level, or the router level: Configuration placement and sequence of execution If no path is provided (e.g., a) the file loads from the working directory (same place you loaded the configuration, usually /etc/krakend) Instead of connecting to next backend in the pipe, returns an empty response and executes the post lua function.Īn array with all the Lua files that will be processed. You can write all the Lua code inline (e.g., print('Hi') print('there!') but you can also call functions that live inside one of the files under sources (e.g., my_function()).Īvailable on the backend section only. Unlike post, it’s available in all sections. The Lua code that is executed before performing the request. You can write all the Lua code inline (e.g., print('Hi') print('there!') but you can also call functions that live inside one of the files under sources (e.g., my_function()). Available when used in the backend section. The Lua code that is executed after performing the request. The md5sum is an extra security feature to make sure that once you have coded the Lua script, the MD5 of what is loaded into memory matches what you expect and has not been tampered by a malicious 3rd party. Set this flag to true if you want to modify the Lua script while KrakenD is running and apply the changes live (mostly during development to avoid the snippet being cached). If you need to import Lua libraries (e.g, the I/O, String, etc.), then you must set this flag to true.įor security and efficiency, the Lua script is loaded once into memory and not reloaded even if the file contents change. As an efficiency point the Lua component does not load the standard libraries by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |