TX028

차단된 호스트

콘솔

Text.js error TX028: Blocked request. This host (…) is not allowed. Add it to `…` in text.config.ts.

발생 원인

text dev와 루프백에 바인딩된 text start(기본값)는 localhost, *.localhost 이름 또는 IP 주소로 오는 요청에만 응답해요. 이는 DNS 리바인딩을 방지해요. 다른 Host 헤더가 있는 요청이 들어왔으며, 보통 터널, 리버스 프록시 또는 LAN 호스트 이름을 거친 요청이에요.

해결 방법

text.config.ts에서 호스트를 허용하세요. text dev는 Vite의 vite.server.allowedHosts를 읽고, text start는 server.allowedHosts를 읽어요. 맨 앞에 .을 붙이면 하위 도메인을 허용해요:

text.config.tsts
import { defineConfig } from "@textjs/app";export default defineConfig({  // text dev  vite: { server: { allowedHosts: ["my-laptop.local", ".ngrok.app"] } },  // text start  server: { allowedHosts: [".example.com"] },});

text start --host에 루프백 이외의 주소를 지정하면 검사를 건너뛰어요. 프록시 뒤에서 실행을 참고하세요.