Repository navigation
Description
Summary
When accessing the Trinity frontend via a custom domain (e.g., trinity.example.com), Vite 6.x blocks the request with the error: "Blocked request. This host is not allowed." This is due to Vite 6.x's new security feature requiring explicit allowedHosts configuration. The frontend is inaccessible via custom domains until this is fixed.
Component
Frontend / Vite Configuration
Priority
P1 - Major feature broken (frontend inaccessible via custom domains)
Error
Blocked request. This host ("trinity.example.com") is not allowed.
To allow this host, add "trinity.example.com" to `server.allowedHosts` in vite.config.js.
Location
- File:
src/frontend/vite.config.js - Line: N/A (missing configuration)
- Function/Class:
serverconfig block
Root Cause
Vite 6.x introduced stricter host checking as a security measure. The current vite.config.js does not include the allowedHosts configuration, causing Vite to block requests from any host other than localhost.
Reproduction Steps
- Deploy Trinity to a server
- Configure a custom domain pointing to the Trinity frontend (e.g., via reverse proxy or DNS)
- Access the frontend via the custom domain
- Observe the "Blocked request" error
Suggested Fix
Add allowedHosts to the server configuration in vite.config.js:
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 80,
// Allow all hosts since Trinity is typically behind a reverse proxy
// that handles host validation
allowedHosts: true,
proxy: {
// ... existing proxy config
}
}
})Alternatively, for more restrictive environments, use an environment variable:
server: {
allowedHosts: process.env.VITE_ALLOWED_HOSTS?.split(',') || true,
// ...
}Environment
- Trinity version:
281ee77 - Vite version:
^6.0.6 - @vitejs/plugin-vue:
^5.2.1
Related
- Vite docs: https://vite.dev/config/server-options.html#server-allowedhosts
- Affected file:
src/frontend/vite.config.js
Activity
vybe commentedon Feb 24, 2026
Fixed in vite.config.js by adding
allowedHosts: trueto the server configuration.Change:
src/frontend/vite.config.js:17-18This allows Vite 6.x to accept requests from custom domains. The security consideration noted in Vite docs is mitigated by Trinity's architecture - the Vite dev server runs inside a Docker container behind nginx, which handles host validation at the reverse proxy level.
fix: Add Vite 6.x allowedHosts for custom domain access