Files
proxy-luco-faq/README.md
T
2026-10-26 20:05:45 +07:00

1.2 KiB

luko-faq-proxy (ifserver2)

Proxy publik untuk bot FAQ Luko. Browser memanggil proxy ini, lalu proxy meneruskan pertanyaan ke endpoint terkunci /faq-api di ifserver1. Endpoint itu hanya menerima IP ifserver2 dan wajib basic auth.

Deploy via Coolify (ifserver2)

  1. Upload folder ini ke repo Git (GitHub/GitLab), atau ekstrak luko-faq-proxy.tar.gz lalu push.
  2. Coolify → New Resource → Application → pilih repo tersebut. Build pack: Dockerfile.
  3. Environment Variables: salin isi .env.example.
  4. Port: 8080.
  5. Domain: misalnya https://faq.ifuntanhub.dev. Coolify membuat sertifikat TLS otomatis.
  6. Deploy.

Cek

curl https://faq.ifuntanhub.dev/healthz
curl -X POST https://faq.ifuntanhub.dev/v1/faq -H "Content-Type: application/json" -d '{"query":"siapa kaprodi"}'

Respons: {type: "answer"|"suggest"|"fallback", result, faq_id, score, suggestions: [{id, question}]}.

Frontend

const res = await fetch("https://faq.ifuntanhub.dev/v1/faq", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ query: pertanyaan }),
});
const data = await res.json();

Origin yang diizinkan diatur di ALLOWED_ORIGINS. Batas request per IP per menit diatur di RATE_MAX.