docs: Update DDEV usage - set .ddev.site explicitly for server.cors.origin, add support for custom https_router_port for server.origin#99
Merged
Conversation
…bout Vite article
Contributor
Author
|
Okay, one question is remaining. For using 'devServerPublic' => App::env('PRIMARY_SITE_URL') . ':3000',to 'devServerPublic' => preg_replace('/:\d+$/', '', App::env('PRIMARY_SITE_URL')) . ':3000',to also support primary URLs like |
Contributor
Author
Just tested it, it is indeed needed to strip away the custom https port via Updated the PR, ready for review ✅ |
Contributor
|
Thanks again, appreciate it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Changes:
use
\.ddev\.siteexplicitly for regex forserver.cors.origin, as proposed by vitejs core maintainer - otherwise the attack surface is still open via sites with.siteTLDsupport custom
router-https-port(test viaddev config --router-https-port 8443 && ddev restart-process.env.DDEV_PRIMARY_URLwill then output "https://my-project.ddev.site:8443". Therefore we need to strip out 8443 first, before setting theserver.originsetting. This is also relevant because DDEV auto-selects a router port if 80/443 is already occupied since last year (https://ddev.com/blog/release-v1235-auto-port-assignment/). This needs a tiny change inconfig/vite.phpas well.add info about official article about Vite on ddev.com (https://ddev.com/blog/working-with-vite-in-ddev/) where users find out more information and where DDEV maintainers try to keep all further infos up-to-date.
Hope this will be it, fingers crossed. Thanks very much for providing this plugin!
(Demo repo with this config is available here: https://github.com/mandrasch/ddev-craftcms-vite)
Related issues