I am running a backend Laravel API and a frontend Vue.js application.
Option #1 would be to set those two up as follows:
api.example.com => serving the API
app.example.com => serving the frontend appplication
However this gets you in all the trouble with CORS, OPTIONS preflight etc.
So in order to avoid that, I am planning on setting it up like this:
app.example.com/api => serving the API
app.example.com => serving the frontend appplication
So no more CORS problems, but since I am using Webpack I am running into issues in local development. Webpack dev server is serving the frontend at:
app.example.com:8080
So again, I am running into CORS when trying to access the API on port 80 :-(
Help! How can I set this up, so I don't have to deal with CORS yet being able to make use of the Webpack dev server and the Laravel (Homestead) API backend?
I assume it's not possible to serve both Homestead as well as Webpack from the same hostname and port. But is there any set-up that avoids CORS?