Datacenter CORS & Network Configuration
This guide explains how to configure Cross-Origin Resource Sharing (CORS) and network access controls when deploying Power Prompt into a customer’s private datacenter, private cloud, or on-premises infrastructure.
1. Overview
When Power Prompt is deployed to a customer’s infrastructure with custom corporate domains (e.g. https://powerprompt.customer.corp or https://ai.company.internal), the Fastify API backend validates incoming browser Origin headers against an allowlist to prevent unauthorized third-party cross-site request forgery and cross-origin data access.
2. Configuration Location
All domain and CORS settings are managed via a single environment configuration file on the backend node:
- Production / Datacenter Path:
/etc/powerprompt/backend.envor/opt/powerprompt/.env - File Permissions:
chmod 600 /etc/powerprompt/backend.env(Readable only byroot/powerpromptservice user) - Local Development Path:
apps/backend/.env
3. Configuration Variables
Set one or more of the following variables in /etc/powerprompt/backend.env:
| Variable Name | Description | Example Value | Required? |
|---|---|---|---|
FRONTEND_URL | Primary URL of the frontend Web SPA | https://powerprompt.customer.corp | Recommended |
BACKEND_URL | Public/internal base URL of the API gateway | https://powerprompt.customer.corp/api | Optional |
ALLOWED_ORIGINS | Comma-separated list of additional allowed origins | https://powerprompt.customer.corp,https://portal.customer.corp | Optional |
4. Example Production Customer Configuration (/etc/powerprompt/backend.env)
# ==============================================================================# Power Prompt Enterprise Backend Environment Configuration# Datacenter: Customer On-Premises Cluster# ==============================================================================
# Server RuntimeNODE_ENV=productionPORT=8080HOST=0.0.0.0
# ------------------------------------------------------------------------------# 1. Customer Domains & CORS Allowlist# ------------------------------------------------------------------------------FRONTEND_URL=https://ai.customer-corp.comBACKEND_URL=https://ai.customer-corp.com/apiALLOWED_ORIGINS=https://ai.customer-corp.com,https://portal.customer-corp.com
# ------------------------------------------------------------------------------# 2. Database Connection (PostgreSQL 17)# ------------------------------------------------------------------------------DB_HOST=databaseDB_PORT=5432DB_NAME=powerprompt_prodDB_USER=pp_user_blueDB_PASSWORD=SecureCustomerGeneratedPassword123!DB_SSL=false
# ------------------------------------------------------------------------------# 3. Security Secrets (Must be unique per customer deployment)# ------------------------------------------------------------------------------JWT_SECRET=customer-unique-jwt-secret-min-32-charactersDATA_ENCRYPTION_KEY=customer-unique-64-hex-char-encryption-key-for-aes-256-gcm5. Built-in Zero-Configuration Allowlist
The Power Prompt backend includes automatic origin detection out-of-the-box:
-
Private Corporate Subnets (RFC 1918):
10.0.0.0/8(e.g.http://10.0.1.10:3000,http://10.200.1.5:3000)172.16.0.0/12(e.g.http://172.20.0.15)192.168.0.0/16(e.g.http://192.168.1.100)localhost/127.0.0.1(Local testing and reverse proxies)- All internal IP addresses within these ranges are accepted automatically without explicit configuration.
-
Power Prompt Browser Extensions:
- All browser extension origins (
chrome-extension://*) are accepted by default to allow side-panel extension functionality.
- All browser extension origins (
-
Non-Browser / Server-to-Server Requests:
- Health checks, monitoring daemons, curl, and backend-to-backend API integrations (which send no
Originheader) are accepted without restriction.
- Health checks, monitoring daemons, curl, and backend-to-backend API integrations (which send no
6. How to Apply Changes
Whenever you modify the configuration file on the server, restart the services to reload:
# For Docker Compose deployments:cd /opt/powerprompt && sudo docker compose restart backend
# For native Linux systemd deployments:sudo systemctl restart powerprompt-backendsudo journalctl -u powerprompt-backend -n 25 --no-pager