To make this work, I need these three steps:
Ports
npm run dev must not only open port 5173 on localhost, but on all addresses. This is done with a change in vite.config.ts:
import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], server: { host: '0.0.0.0', port: 5173 } });
Browser settings
On the (Chrome) browser of the phone or tablet open
chrome://flags/#unsafely-treat-insecure-origin-as-secure
and set it to the IP address of svkitdev in your network
http://192.168.179.41:5173
Cookies
This requires a hack in the Sveltekit code. In node_modules@sveltejs\kit\src\runtime\server\cookie.js change
/** @type {import('cookie').CookieSerializeOptions} */
const defaults = {
httpOnly: true,
sameSite: 'lax',
secure: false // MUH url.hostname === 'localhost' && url.protocol === 'http:' ? false : true
};