From c5ab10b9c73697ae0ca3a458ecb18be95c6983f9 Mon Sep 17 00:00:00 2001 From: Matthias Andrasch <777278+mandrasch@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:35:39 +0100 Subject: [PATCH 1/2] docs: support custom https_router_ports for server.origin, add info about Vite article --- docs/docs/index.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/docs/index.md b/docs/docs/index.md index d60fc19..8ccdd8c 100755 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -372,10 +372,10 @@ server: { host: '0.0.0.0', port: 3000, strictPort: true, - origin: `${process.env.DDEV_PRIMARY_URL}:3000`, + origin: `${process.env.DDEV_PRIMARY_URL.replace(/:\d+$/, "")}:3000`, cors: { - origin: /https?:\/\/([A-Za-z0-9\-\.]+)?(localhost|\.local|\.test|\.site)(?::\d+)?$/ - } + origin: /https?:\/\/([A-Za-z0-9\-\.]+)?(\.ddev\.site)(?::\d+)?$/, + }, } ``` @@ -397,7 +397,7 @@ return [ // for Vite v4 and below // 'manifestPath' => '@webroot/dist/manifest.json', - + // for Vite >= v5 'manifestPath' => '@webroot/dist/.vite/manifest.json' @@ -424,6 +424,8 @@ web_environment: Then be sure to set `criticalUrl` to `http://localhost` as part of your rollup configuration. +For more information about DDEV and Vite, see [Working with Vite in DDEV](https://ddev.com/blog/working-with-vite-in-ddev/). + Finally note that as of DDEV 1.19 you are able to specify Node.js (and Composer) versions directly via `/.ddev/config.yaml`. See more at https://ddev.readthedocs.io/en/stable/users/cli-usage/#nodejs-npm-nvm-and-yarn In earlier versions of DDEV (< v1.20.0), you had to use a docker-compose file to expose the port. This is not necessary anymore. We leave this guide here as legacy information: From 1d0fe9d12a079d7192040e4c1f98feb03daa9fc7 Mon Sep 17 00:00:00 2001 From: Matthias Andrasch <777278+mandrasch@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:56:23 +0100 Subject: [PATCH 2/2] fix: add support for custom `router-https-port` for DDEV --- docs/docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/index.md b/docs/docs/index.md index 8ccdd8c..a6ca98f 100755 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -391,11 +391,11 @@ use craft\helpers\App; return [ 'checkDevServer' => true, 'devServerInternal' => 'http://localhost:3000', - 'devServerPublic' => App::env('PRIMARY_SITE_URL') . ':3000', + 'devServerPublic' => preg_replace('/:\d+$/', '', App::env('PRIMARY_SITE_URL')) . ':3000', 'serverPublic' => App::env('PRIMARY_SITE_URL') . '/dist/', 'useDevServer' => App::env('ENVIRONMENT') === 'dev' || App::env('CRAFT_ENVIRONMENT') === 'dev', - // for Vite v4 and below + // for Vite v4 and below // 'manifestPath' => '@webroot/dist/manifest.json', // for Vite >= v5