Request is shown as POST request when refreshing browser

Hey!

I have a kirby()->request()->is('post') if statement in my controller. When requesting this page with POST, that works. However when refreshing the side (get request), still the is(‘post’) function is returning true. var_dump('Is post: '.kirby()->request()->is('post')); returns 1.

I guess this could be a caching problem. Is there a way to refresh the cache after the POST request? Or does this issue have a different root?

Greetings,
Jonas

This is standard behaviour. The usual procedure to get out of the POST request is the PRG pattern: https://en.wikipedia.org/wiki/Post/Redirect/Get

You can do a redirect to the same page if you don’t want to redirect to another page. Another option is using JavaScript.

1 Like

Ah nice, thank you!
For others with the same problem, i solved that by calling the following after processing the request:
redirect::to(page('url')->url());