This is for @sveltejs/kit <= 1.0.0-next.525
.
https://github.com/torenware/ddev-viteserve might fit your needs better if you are not using svelte.
Note: This will not install if there is already a src/hooks.server.[jt]s
file.
You should review your src/hooks.server.[jt]s
file and either remove it or you'd have to adjust all your files manually.
This exposes the debug port of vite on the container port 9229 aswell. To use it, run
ddev viteinspect
instead of ddev yarn dev
.
- Overwrite
.ddev/nginx_full/nginx-site.conf
to proxy requests tohttp://localhost:5173
and pass the adjusted origin. - Install a
src/hooks.server.js
to adjust the origin toDDEV_PRIMARY_URL
on outgoing cors requests when using svelte's providedfetch
. - Add this
src/hooks.server.js
to.git/info/exclude
. - Install a
.ddev/docker-compose.network.yaml
to add additional known hosts in the network. - Install a
.ddev/docker-compose.debug.yaml
to expose the vite debugging port
ddev config --auto --omit-containers=db,dba --nodejs-version=16
mkcert -install
ddev get mdc-git/ddev-sveltekit
ddev viteinspect
-
-
see nginx-site.conf:
proxy_set_header Origin http://node-srv;
-
this fixes
Cross-site POST form submissions are forbidden
on internal/api
requests.
-
-
sveltejs/kit#6608 (see hooks.server.js)
-
this essentially handles outgoing cors fetch requests in endpoints.
-
it should override the outgoing requests origin
event.url
toDDEV_PRIMARY_URL
-
this makes it semantically consistent with the external servers
Access-Control-Allow-Origin
-
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin#description
- https://stackoverflow.com/questions/42239643/when-do-browsers-send-the-origin-header-when-do-browsers-set-the-origin-to-null/42242802
-
A linux binary of jq and hjson along with a small utility script to attach vscode to
containerip:9229
will be installed under .ddev/sveltekit and .ddev/commands/host which will increase the repository size to ~5MB. I need them to rewrite my vscode config. Sorry if that annoys you.