CORS requests between Laravel applications uses wrong database
Anyone ever had an issue with CORS requests between two Laravel applications not working properly because the requested application starts using the database from the original application?
I work on a lot of internal tools in my company, let's say an ERP, a dashboard, an invoice manager and more. All of these services might need data from a centralized database (logging for example).
When for example our ERP makes requests to our centralized database it might happen that the centralized database tries to access the database of the ERP with the tables of the centralized database, and returns a session token that is from the ERP and not the centralized database.
The ERP is using the URL erp.company.com.test and the centralized database is using the URL company.com.test, databases are both named after the URL.
Never had the issue on my MacBook pro using Laravel Valet nor on our staging/production environments (thanks god) but it makes development on Windows with Laragon quite challenging.
The issue was temporarily patched when we changed the ERP's url to erp-company.com.test has I was thinking the CORS request was having an issue when using a subdomain but the issue seem to happen again...
Anyone ever encountered the same issue?
Thanks in advance to anyone helping and happy holidays!
@fhusquinet : Have you tried using Nginx as web server?
This post is deleted!
Didn't think of that, but indeed that seem to have done the trick!
Thanks a lot, no more headaches because of that anymore! 😅