-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feature: Support echo plugin #1225
Comments
@Akayeshmantha Cool, you can add your ideas to https://cwiki.apache.org/confluence/display/COMDEV/GSoC+2020+Ideas+list, and we can talk about in slack: https://the-asf.slack.com/ |
This plugin could implement the corresponding functionality in the common phases such as |
As far as i am concerned, this plugin is still necessary to help other people understand how to implement a plugin as fully as possible. Thanks. |
@agile6v so what is the path we are taking implmenting a new plugin or extending the existing plugin 🙂 |
Hi @Akayeshmantha Remember that you submitted a proposal at GSOC. How about we follow that plan? First we implement a simple echo function and then implement a function that modify the response body. For example, adding content before or after the response body. Thanks. |
@agile6v sure think that is a good way to start. |
Can you provide some use cases? |
Hi @Akayeshmantha This example can be used as a reference. Not sure I've made it a clear. If you have any questions, welcome to discuss here. Thanks. |
Hi @agile6v Or are we going with nginx.logging() |
@Akayeshmantha We're going to implement an echo plugin, right? So we refer to its features to implement APISIX's echo plugin? Thanks. |
@agile6v you'd better show same specific examples in Apache APISIX |
Hi @agile6v so from what I get when it comes to the output_filter phase we should replicate what we have in https://github.com/openresty/echo-nginx-module/blob/master/src/ngx_http_echo_module.c#L412 ? or simply |
We can refer to the implementation of the plugin response-rewrite. It has the ability to override the response body. In the echo plugin we implement the function like this: function _M.body_filter(conf, ctx)
conf.before_body + response.body + conf.after_body
end FYI: https://github.com/openresty/lua-nginx-module#body_filter_by_lua Hope I've described it clearly. Thanks. |
@agile6v I drafted a small sample can you look in the PR ? |
APISIX currently provides a simple example plugin, but it does not provide useful functionality. So we can provide a useful plugin to help users understand as fully as possible how to develop an APISIX plugin.
The text was updated successfully, but these errors were encountered: