You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say you have the app server and dev server both running on the same machine:
335
+
336
+
- App server π `http://localhost:1234`
337
+
- Dev server π `http://localhost:5678`
338
+
339
+
Then, you setup a reverse proxy in front of the app server and dev server:
340
+
341
+
- Reverse proxy π `https://myhost`
342
+
343
+
But the internal HTTP and WebSocket connections to support hot updates will still try to reach the dev server's unproxied origin:
344
+
345
+
- Hot updates π `http://localhost:5678` / `ws://localhost:5678` β
346
+
347
+
To get the internal connections to point to the reverse proxy, you can use the `REMIX_DEV_ORIGIN` environment variable:
348
+
349
+
```sh
350
+
REMIX_DEV_ORIGIN=https://myhost remix dev
351
+
```
352
+
353
+
Now, hot updates will be sent correctly to the proxy:
354
+
355
+
- Hot updates π `https://myhost` / `wss://myhost` β
356
+
331
357
### Troubleshooting
332
358
333
359
#### HMR: hot updates losing app state
@@ -336,8 +362,7 @@ Hot Module Replacement is supposed to keep your app's state around between hot u
336
362
But in some cases React cannot distinguish between existing components being changed and new components being added.
337
363
[React needs `key`s][react-keys] to disambiguate these cases and track changes when sibling elements are modified.
338
364
339
-
Additionally, when adding or removing hooks, React Refresh treats that as a brand new component.
340
-
So if you add `useLoaderData` to your component, you may lose state local to that component.
365
+
Additionally, when adding or removing hooks, React Refresh treats that as a brand new component. So if you add `useLoaderData` to your component, you may lose state local to that component.
341
366
342
367
These are limitations of React and [React Refresh][react-refresh], not Remix.
0 commit comments