Can't Login in Production Mode

Hi,
I’m using this code to prevent redirection in Shopware 6:

<input type="hidden"
                               name="redirectTo"
                               value="{{current_path}}">

                        <input type="hidden"
                               name="redirectParameters"
                               value='{"navigationId": "{{ page.navigationId }}"}'>

This Code Works just fine in dev mode but the Problem is as soon as i change the dev mode to prod Login not Working or i have to refresh the page to make this work.
any idea?