0

I'm running Rails 5.0.2 on a project, looking to use react-rails and webpacker to handle things on the front end. I've only got a few components/pages that need to be dynamic, so I'm leveraging server-side rendering for a majority of the pages.

I've got, so far as react-rails is concerned, a pretty standard set up with webpacker. After following the instructions in their readme, I can load a page with CommonJS modules and whatnot.

The problem: Since webpacker is serving up its assets on localhost:8080 and rails is operating on localhost:3000, the session cookie I start in the static half of the site isn't accessible to the dynamic half. I know I can probably solve this with an nginx proxy, but I was wondering if there wasn't an existing fix for this with the aforementioned tools, as this is kind of a game breaker for local dev!

fredugolon
  • 518
  • 3
  • 9

1 Answers1

1

Webpack provides a proxy configuration when using their webpack-dev-server: https://webpack.js.org/configuration/dev-server/#devserver-proxy

This should proxy any request that isn't a static file.

Ecuageo
  • 26
  • 5