fix(supabase): LAN trial answers its own host only, guide matches lot O

This commit is contained in:
bchanot committed 2026-11-04 23:19:57 +01:00
1 parent 060ee50464
commit 5207f87e66
3 files changed
+29 -8

No files matched your search

+1 -1
View File
@@ -102,7 +102,7 @@ async function createNonEquineSheet(page: Page, tag: string) {
test('trial through the LAN origin: MFA, new sheet, SVG import, save, reload', async ({
page,
}) => {
test.skip(!email || !password, 'TRIAL_EMAIL and TRIAL_PW_FILE are required')
test.skip(!email || !password, 'TRIAL_EMAIL and TRIAL_PW_FILE are required') // floor-guard: allow C47 run by hand on a live trial
test.setTimeout(120_000)
const local: string[] = []
page.on('request', (request) => {
+18 -1
View File
@@ -1,5 +1,5 @@
import { fileURLToPath } from 'node:url'
import { defineConfig, mergeConfig } from 'vite'
import { defineConfig, mergeConfig, type Plugin } from 'vite'
import base from '../vite.config'
/**
@@ -27,8 +27,25 @@ if (!PRIVATE_IPV4.test(host))
const SUPABASE_ROUTES = ['/auth/v1', '/rest/v1', '/storage/v1']
const REPO = fileURLToPath(new URL('../../../', import.meta.url))
/**
* `allowedHosts` still lets every IP literal and localhost through (Vite 7):
* any Host other than the trial host gets a 403.
*/
const trialHostOnly: Plugin = {
name: 'faunosteo-trial-host-only',
configureServer(server) {
server.middlewares.use((req, res, next) => {
const name = (req.headers.host ?? '').replace(/:\d+$/, '')
if (name === host) return next()
res.statusCode = 403
res.end()
})
},
}
export default defineConfig((env) =>
mergeConfig(base(env), {
plugins: [trialHostOnly],
// One validated host, never 0.0.0.0: the proxy carries the trial account's session.
server: {
host,