How to retry post call in kong?

Kong gateway sometimes response connection error, so I’d like to retry upsteam call.
I tried retries setting of route in kong.yaml.
When request method was GET, Kong retry 5 times (default setting) . But, kong doesn’t retry in POST request.

I also tried below environment variables for setting nginx directry;

kong_nginx_proxy_proxy_next_upstream
kong_nginx_proxy_proxy_next_upstream_tries

but this setting doesn’t effect.
If anyone knows a solution, please let me know. thank you.

@7010raimi Are you aware of this nginx configuration?

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#:~:text=code%20429%20(1.11.13)%3B-,non_idempotent,upstream%20server%20(1.9.13)%3B%20enabling%20this%20option%20explicitly%20allows%20retrying%20such%20requests%3B,-off

Kong does not enable non_idempotent by default

As you instructed, I added the following settings and the retry of POST request was successful.
Thank you very much for teaching me!

KONG_NGINX_PROXY_PROXY_NEXT_UPSTREAM ‘error timeout http_502 non_idempotent’

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.