You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a local kind cluster on my macbook and trying to deploy my Sveltekit app. Its working great outside of k8s, but I need to setup a bunch of ancillary things and its time to upgrade the stack.
In order to fully test my stack, I require TLS to work and use mkcert to generate local certificates, and also have cert-manager configured to provide self-signed certificates.
I cannot figure out the magical incantation to get both node+HMR to bind to IPv4 AND also provide a client configuration pointing at the dns-name, (not 0.0.0.0).
So if in my vite config I set things to bind to 0.0.0.0, I get IPv4, but then my client sees
"hmr" was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint This request has been blocked; this endpoint must be available over WSS.
or
GET https://0.0.0.0/hmr/ net::ERR_CERT_AUTHORITY_INVALID
if i set vite to use my dns name, it will bind to IPv6, and then nothing works. Wish there was a way to provide both a bind/listen parameter as well as the hostname to provide to the client so that it would understand that my Ingress controller is terminating TLS. (if I enable passthru TLS, then its L4 and can't do the ws connection upgrade which is L7).
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
// import fs from 'fs';
// import path from 'path';
// let key = fs.readFileSync(path.resolve(__dirname, 'certs/tls.key'))
// let cert = fs.readFileSync(path.resolve(__dirname, 'certs/tls.crt'))
export default defineConfig({
plugins: [sveltekit(),
],
server: {
host: '0.0.0.0',
port: 3030,
strictPort: true,
hmr: {
protocol: 'wss', // Use WebSocket protocol / use wss for tls, but not behind an ingress.
// host: 'myapp.com', // This will mess up the binding, as it will bind to IPv6 addresses
host: '0.0.0.0', // this will mess up the client as the client wants a DNS name
port: 24678, // Match the expected HMR port
clientPort: 443, // Adjust as needed
overlay: true, // Show HMR errors on the browser overlay
path: "/hmr/",
},
// https: {
// key: key,
// cert: cert,
// },
},
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});
/app # lsof -Pni | grep LISTEN
node 21 root 21u IPv4 2802096 0t0 TCP 127.0.0.1:24678 (LISTEN)
node 21 root 34u IPv4 2802097 0t0 TCP *:3030 (LISTEN)
/app # grep -A2 hmr vite.config.ts
hmr: {
protocol: 'wss', // Use WebSocket protocol / use wss for tls, but not behind an ingress.
host: 'myapp.com', // This will fuck up the binding, as it will bind to IPv6 addresses
The text was updated successfully, but these errors were encountered:
I'm not a JS expert by any means, any and all help/pointers/tips are appreciated. im also having a hard time believing I'm the first to pioneer this path, so I'm assuming that I'm doing many things wrong.
Describe the bug
I'm running a local
kind
cluster on my macbook and trying to deploy my Sveltekit app. Its working great outside of k8s, but I need to setup a bunch of ancillary things and its time to upgrade the stack.In order to fully test my stack, I require TLS to work and use
mkcert
to generate local certificates, and also havecert-manager
configured to provide self-signed certificates.I cannot figure out the magical incantation to get both node+HMR to bind to IPv4 AND also provide a client configuration pointing at the dns-name, (not 0.0.0.0).
So if in my vite config I set things to bind to 0.0.0.0, I get IPv4, but then my client sees
or
if i set vite to use my dns name, it will bind to IPv6, and then nothing works. Wish there was a way to provide both a bind/listen parameter as well as the hostname to provide to the client so that it would understand that my Ingress controller is terminating TLS. (if I enable passthru TLS, then its L4 and can't do the ws connection upgrade which is L7).
Reproduction
ingress
service
deployment
Logs
No response
System Info
inside container
Severity
blocking all usage of SvelteKit
Additional Information
vite.config.ts
If i flip to use the dns name, it binds wrong
The text was updated successfully, but these errors were encountered: