0
votes

Have to admit I am a Symfony newB. Generally, I do know what I am doing but I am stumped with this problem.

I have been given a pair of packages to maintain. One side is a front end written with Angular.js. Then there is the backed written using Symfony.

After installing the backend portion, using composer. I am now trying to test.

The front end seems to be good when it fires up at xxx.yyy.com/app. Its first screen is a login screen where it asks for username and password. The submit button fires off a request of xxx.yyy.com/api/users/token. The username and password from the screen are stored in the http request as json.

Once the request is made I have determined that app.php in the symfony code fires off and starts the user authentication process. After a lot of work in trying to debug through the code, I can see that the symfony backend does have the user name and password and knows that the request is a POST request in good form. However, I keep getting the error "Route Not Found" and then am kicked out of symfony.

There is every reason to believe the code is written correctly and the problem lies in something I have done to install the code. When I run the debug:router process, I can find the route as a correct one. But, this route is never found. I have also tried other routes with the same result.

Can anyone suggest a reason why routes shown in the debug:router process do not work in actual use? I am really stumped and would appreciate some suggestions.

2
Oddly enough when a route doesn't match. Its not the same as the one showing in the debug:router. Many variables control these things; uri, methods, requirements, route order, caching, etc. Consider posting the routing debug output and your test code sample (How to create a Minimal, Complete, and Verifiable example) so we can actually target the problem instead of throwing out random idea's/ solutions.Jenne

2 Answers

1
votes

Think I am really on to the problem. It's the way that the front end javascript is creating the URL for the backend along with the way my server is configeured.

My front end is xxx.kjitx.com/app This code is then adding the base URL to the command for the backend to form a request of xxx.kjitx.com/api/users/token Then when my backend receives control it is stripping off the xxx.kjitx.com/api part of the url and sending the users/token string to the router. The router is looking for /api/users/token so the routing fails. In the handshake I lost the first piece, api, of the route. Found this out by forcing the front end to add an extra piece of api, i.e. xxx.kjitx.com/api/api/users/token and it works.

Now I just need to go back into my code to properly set up my addressing so I don't loose an important part of the address.

0
votes

Does the app use CORS? Perhaps you have to whitelist your dev domains