How to reload/refresh the current page in EnvoyFilter using lua-filter


Is there a way I can reload/refresh the current page using lua-filter code?

Example: In the following function, it is trying to receive the response and looks for status 503 and replaces with 307 status and redirects to the given location. But instead, I am looking for a way when the 503 error happens, the page should be refresh/reloaded. Is there any header or a way to achieve this?


function envoy_on_response(response_handle)
if response_handle:headers():get(":status") == “503” then
local redirect_url = “{{ .Values.redirectUri }}”
response_handle:headers():replace(":status", “307”)
response_handle:headers():add(“location”, redirect_url)

Adding networking folks. @howardjohn @Costin_Manolache

I don’t know of any way to trigger the browser to refresh, I think that would be a major security risk.