Open jayram88 opened 7 years ago
Hi @jayram88,
It could be wrong configuration for API in your .env file. We use next configurations:
API_PREFIX=api
API_DOMAIN=
API_VERSION=v2
API_DEBUG=true
API_CONDITIONAL_REQUEST=false
Note that API_DOMAIN is empty, please try to make the same in your .env
Thanks for the quick reply @Konro1 , Making API_DOMAIN empty does not solve the issue unfortunately.
What I have figured so far is that the issue is in the match() function in RouteCollection.php. $route = $this->check($routes, $request);
Here the check is returning null for all "api" calls but returning fine for the other "app" calls. Any other ideas?
Does this have something to do with URL rewriting? I am using Homestead locally.
@jayram88 you can use php artisan api:routes
command to see all API routes paths (e.g.: /api/v2/checkUpdates). Full url will look like: http://YOUR_DOMAIN/api/v2/checkUpdates. Please, note that your domain DOOCUMENT_ROOT need to be configured to public directory and all routes in laravel are case sensitive.
Sorry, document root is configured to public and the URL is as you recommended too, there is some difference between how API URIs are matched vs APP URIs....not able to figure it :/
Could you check if your web server has mod_rewrite enabled?
Yes, I am using Fortrabbit and its supposed to be enabled there by default. I suspected the same too though. Do you recommend any particular hosting service that I could try it on to confirm this? (Or any other ideas?)
@Konro1 mod_rewrite is enabled on my server, confirmed it with another htaccess script. Any other ideas?
Does it work if you run the app from Chrome on your machine?
If not - can you use inspector to get the full URL it's requesting?
If you're running it on a mobile device, it may be a DNS issue - I've been playing with connfa recently and ran into some network issues so hope this might help clarify...
@matchett808 I am making the calls manually on chrome and seeing the difference in response between the default base URL and the url of my server(and localhost). Have you managed to host it successfully on your own? What server(service) did you use? And how did you get around your DNS issue?
Hi @Konro1
I think I have the same issue, please see here: http://164.132.197.232/connfa/public/api/v2/checkType
Any idea how to fix this?
Hi, @piraterr
There is no api url http://164.132.197.232/connfa/public/api/v2/checkType, there is http://164.132.197.232/connfa/public/api/v2/checkUpdates, it works.
You can read about all API endpoints here http://connfa.com/api/
Thank you @Konro1 for prompt reply and for the hint.
@jayram88 Just want to follow up on this, is the problem still relevant, or could the issue be closed? If there are any questions, just let me know.
Hi, just to know, I had to use (with index.php):
@phls It seems like you have not mod_rewrite enabled on your web server
@Konro1 mod_rewrite is enabled, but still working with index.php
@phls Do you have .htaccess file in public/ directory ?
@Konro1 yes.
Tried hosting the server on my server, while the normal get calls work ("app" ones) I get 404 errors for all the API calls. Sample call: www.mycustomconnfa.com/login or /dashboard works.
But www.mycustomconnfa.com/api/v2/checkUpdates throws a 404 error. you can replace mycustom.com with localhost:8000 and get the same results.
But using your default base url works (http://connfa-integration.uat.link/)
Any pointers?