having problem to set different subdomain for web route and api routes #37845
Unanswered
moinologics
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What i need - let suppose i had a domain example.com pointing to my laravel app's public directory. i can access my web with example.com & api with example.com/api. but what i need to make a seprate subdomain for api like api.example.com
what i try -
in app/providers/RouteServiceProvider.php 's boot() method, i put
where API_DOMAIN=api.example.com in .env file.
in routes/api.php 's end of file, i put
what problem i facing - i working fine for api.example.com for those routes which i defined inside routes/api.php but when a route didn't found in api.php & also not in routes/web.php the fallback route inside api.php runs and thats ok, but when route not find inside api.php but exists inside web.php than even when doamin is api.example.php, the routes called from web.php which is not good.
what i want now - when a url hit from api.example.com than no route must run from web.php , when a url hit from example.com than only web.php routes must be consider.
laravel version - 8.4
Beta Was this translation helpful? Give feedback.
All reactions