OpenShift Route timeout error

莊子弘
Sep 7, 2021

Error message:

If we used Browser (Ex: Chrome) to call the API. In DevTools, it will show CORS error but actually it’s not.

If we call this API by Postman, it will show “504 timeout”.
We need to update Route setting to fix it.

Solution:

By default setting, OpenShift Route will close the connection after 30 secs if no response. But sometimes back-end server will need more time to deal with that.
In my case, our web-service will retrieve a lot of files to get data then response. So we changed the default setting.

Command:
oc annotate route <route_name> \ — overwrite haproxy.router.openshift.io/timeout=<timeout><time_unit>

Example:
oc annotate route wormhole-api — overwrite haproxy.router.openshift.io/timeout=30m

--

--

莊子弘

文字工作者,不過周一到週五寫的都是程式碼。閒暇時間會分享一些心得,包含技術文章或影集書籍觀後感。