When I do a redirectToRoute, I want to pass hidden parameters. Pass the parameter in a route does not satisfating me, because I want the information hidden. I was thinking to do that with POST, but I don't know how to pass POST parameters in the redirectToRoute function. Can I do that ?
- No parameters for a redirect. And the next time you have a browser running, press F12 then click on the network tab. Then ask yourself how exactly can you hide information from even a slightly knowledgeable user.Cerad– Cerad2019-04-02 22:31:16 +00:00Commented Apr 2, 2019 at 22:31
Add a comment |
2 Answers
You can't redirect a POST request because the browser would have to resend the POST data , so you have to use forward like:
return $this->redirectToRoute('name_of_route_to_redirect', ['max' => 10,...]); For more information , take a see in the documentation symfony controller
You can send the Request object inside :
return $this->redirectToRoute('route', [ 'request' => $request ], 307); that 307 guarantees that the method and the body will not be changed when the redirected request is made