DEV Community

Discussion on: Dealing with CORS

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

I don't really understand. Does this solve the problem with Webpack Dev Server or Gatsby?

Collapse
 
patryktech profile image
Patryk

I've never used Gatsby, and the webpack work I do is usually with vue.js, but if your webpack dev server is communicating with an API, yes.

I run similar containers (Django for back-end, vue.js for front-end) on my dev machine as in production.

The difference is I serve a built SPA from nginx in production, and run the nodejs server in dev - but then I still have an nginx container for routing.

I point my base URL to /api/ (or often to /graphql/), then it doesn't matter whether I access my dev site through localhost, or dev.example.com, or if I access staging.example.com, or just example.com in production... It Just Works™.