You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/09 06:46:48 UTC

[GitHub] [apisix] nanamikon commented on issue #3565: request help: Support customizing the body when response exits

nanamikon commented on issue #3565:
URL: https://github.com/apache/apisix/issues/3565#issuecomment-775712478


   Refer to custom-error-pages feature provided by Ingress
   https://kubernetes.github.io/ingress-nginx/user-guide/custom-errors/
   
   Using a docker image as backend to deal with specific error code,  and pass params through header
   ```
   location @custom_upstream-default-backend_500 {
      internal;
      
      proxy_intercept_errors off;
      
      proxy_set_header       X-Code             500;
      proxy_set_header       X-Format           $http_accept;
      proxy_set_header       X-Original-URI     $request_uri;
      proxy_set_header       X-Namespace        $namespace;
      proxy_set_header       X-Ingress-Name     $ingress_name;
      proxy_set_header       X-Service-Name     $service_name;
      proxy_set_header       X-Service-Port     $service_port;
      proxy_set_header       X-Request-ID       $req_id;
      proxy_set_header       Host               $best_http_host;
      
      set $proxy_upstream_name upstream-default-backend;
      
      rewrite                (.*) / break;
      
      proxy_pass            http://upstream_balancer;
      log_by_lua_block {
       
       monitor.call()
       
      }
     }
   
   ``` 
   
   I think we can use header too,  and list all support headers in doc for extension


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org