We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When requesting services through the gateway, the ResponseFilter method in the plugin will not be executed。
The code is as follows
func init() { err := plugin.RegisterPlugin(&MyRewriteResponse{}) if err != nil { log.Fatalf("failed to register plugin MyRewriteResponse: %s", err) } } // it to the upstream. type MyRewriteResponse struct { // Embed the default plugin here, // so that we don't need to reimplement all the methods. plugin.DefaultPlugin } type MyRewriteResponseConf struct { Tag string `json:"tag"` } func (p *MyRewriteResponse) Name() string { return "my-rewrite-response" } func (p *MyRewriteResponse) ParseConf(in []byte) (interface{}, error) { conf := MyRewriteResponseConf{} err := json.Unmarshal(in, &conf) return conf, err } func (p *MyRewriteResponse) ResponseFilter(conf interface{}, w pkgHTTP.Response) { w.Header().Set("responseid", uuid.New().String()) tag := conf.(MyRewriteResponseConf).Tag if len(tag) > 0 { _, err := w.Write([]byte(tag)) if err != nil { log.Errorf("failed to write: %s", err) } } }
the config as flows:
{ "uri": "/user/*", "name": "用户服务", "desc": "用户服务", "methods": [ "GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE" ], "plugins": { "ext-plugin-post-resp": { "_meta": { "disable": false }, "conf": [ { "name": "my-rewrite-response", "value": "{\"tag\":\"hello my-rewrite-response\"}" } ] } }, "upstream_id": "454615881717122005", "labels": { "API_VERSION": "V1" }, "status": 1 }
uname -a
The text was updated successfully, but these errors were encountered:
the chart of apisix do not enabled the ext-plugin-post-resp . we need enable it by myself。
Sorry, something went wrong.
No branches or pull requests
Issue description
When requesting services through the gateway, the ResponseFilter method in the plugin will not be executed。
The code is as follows
the config as flows:
Environment
uname -a
):Linux 5017 3.10.0-1127.el7.x86_64 ci: enable #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/LinuxThe text was updated successfully, but these errors were encountered: