|
16 | 16 | - [Sub-paths](#sub-paths) |
17 | 17 | - [Sub-domains](#sub-domains) |
18 | 18 | - [Why does the code-server proxy strip `/proxy/<port>` from the request path?](#why-does-the-code-server-proxy-strip-proxyport-from-the-request-path) |
| 19 | + - [Proxying to Create React App](#proxying-to-create-react-app) |
19 | 20 | - [Multi-tenancy](#multi-tenancy) |
20 | 21 | - [Docker in code-server container?](#docker-in-code-server-container) |
21 | 22 | - [How can I disable telemetry?](#how-can-i-disable-telemetry) |
@@ -226,25 +227,28 @@ However many people prefer the cleaner aesthetic of no trailing slashes. This co |
226 | 227 | to the base path as you cannot use relative redirects correctly anymore. See the above |
227 | 228 | link. |
228 | 229 |
|
229 | | -For users who are ok with this tradeoff, pass `--proxy-path-passthrough` to code-server |
230 | | -and the path will be passed as is. |
| 230 | +For users who are ok with this tradeoff, use `/absproxy` instead and the path will be |
| 231 | +passed as is. e.g. `/absproxy/3000/my-app-path` |
231 | 232 |
|
232 | | -This is particularly a problem with the `start` script in create-react-app. See |
| 233 | +### Proxying to Create React App |
| 234 | +
|
| 235 | +You must use `/absproxy/<port>` with create-react-app. |
| 236 | +See [#2565](https://github.com/cdr/code-server/issues/2565) and |
233 | 237 | [#2222](https://github.com/cdr/code-server/issues/2222). You will need to inform |
234 | | -create-react-app of the path at which you are serving via `homepage` field in your |
235 | | -`package.json`. e.g. you'd add the following for the default CRA port: |
| 238 | +create-react-app of the path at which you are serving via `$PUBLIC_URL` and webpack |
| 239 | +via `$WDS_SOCKET_PATH`. |
236 | 240 |
|
237 | | -```json |
238 | | - "homepage": "/proxy/3000", |
| 241 | +e.g. |
| 242 | +
|
| 243 | +```sh |
| 244 | +PUBLIC_URL=/absproxy/3000 \ |
| 245 | + WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \ |
| 246 | + BROWSER=none yarn start |
239 | 247 | ``` |
240 | 248 |
|
241 | | -Then visit `https://my-code-server-address.io/proxy/3000` to see your app exposed through |
| 249 | +Then visit `https://my-code-server-address.io/absproxy/3000` to see your app exposed through |
242 | 250 | code-server! |
243 | 251 |
|
244 | | -Unfortunately `webpack-dev-server`'s websocket connections will not go through as it |
245 | | -always uses `/sockjs-node`. So hot reloading will not work until the `create-react-app` |
246 | | -team fix this bug. |
247 | | - |
248 | 252 | Highly recommend using the subdomain approach instead to avoid this class of issue. |
249 | 253 |
|
250 | 254 | ## Multi-tenancy |
|
0 commit comments