symfony - Symfony2 app.php receiving POST request as GET app_dev.php works fine -
so i'm creating route requires posting. route follows:
my_route: path: /myroute/login defaults: { _controller: "mybundle:default:login"} methods: [post] so use postman hit app_dev.php/myroute/login , correct response looking for, page returns "hello world". when change postman hit app.php/myroute/login error saying:
the server returned "405 method not allowed". i'm confused why says method not allowed tailed prod.log file , got following:
uncaught php exception symfony\component\httpkernel\exception\methodnotallowedhttpexception: "no route found "get /myroute/login": method not allowed (allow: post)" i'm sending requests in postman post requests somehow symfony seeing them requests. again can change url app_dev.php/myroute/login , hit send , works. thought caching issue tried following clear caches:
$ php app/console cache:clear --env=prod --no-debug this still doesn't clear problem removed files app/cache/prod well. can't find having issues similar i'm hoping can point me in right direction. thought might
after more digging discovered issue was. thought maybe postman sending incorrect method googled around lead this
which lead question htaccess files:
so first off set postman hit app.php/myroute/login , xdebug showed request method get. moved .htaccess file , hit same url , request method showed post. instead of hitting url moved .htaccess file , pointed @ /myroute/login , lit up. extremely annoying exercise hope save else in future looking same problem.
Comments
Post a Comment