typebot.io icon indicating copy to clipboard operation
typebot.io copied to clipboard

Add instructions on how to properly configure NGINX forwarded host

Open baptisteArno opened this issue 2 years ago • 3 comments

Discussed in https://github.com/baptisteArno/typebot.io/discussions/826

Originally posted by Robert-J-Barros September 19, 2023

hey guys

When accessing the viewer url of my published chat I receive the error "404 The bot you're looking for doesn't exist" image image

I viewed the container logs and apparently everything is normal. image

currently docker-compose.yml is defined as follows:

version: '3.3'
services:
  typebot-db:
    image: postgres:13
    restart: always
    volumes:
      - ${PWD}/.typebot/database:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=typebot
      - POSTGRES_PASSWORD=typebot
  typebot-builder:
    image: baptistearno/typebot-builder:latest
    restart: always
    depends_on:
      - typebot-db
    ports:
      - '8080:3000'
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    env_file: .env
  typebot-viewer:
    image: baptistearno/typebot-viewer:latest
    restart: always
    ports:
      - '8081:3000'
    env_file: .env

My set environment variables are as follows:

ENCRYPTION_SECRET=do+UspMmB/rewbX2K/rskFmtgGSSZ8Ta
DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
NEXTAUTH_URL=https://typebot.fairness.com.br
NEXT_PUBLIC_VIEWER_URL=https://bot.fairness.com.br
[email protected]
SMTP_HOST=smtp.email.sa-saopaulo-1.oci.oraclecloud.com 
SMTP_PORT=587 
SMTP_USERNAME=ocid1.user.oc1..aaaaaaaazicvws42iswxwncmfevpd2nit3gnzvby4l2mzs5zshh3ikk6khmq@ocid1.tenancy.oc1..aaaaaaaakpvlqegag66ttckxyjzhhbllfqyiuxakpzuw7nyilf2x7afqkbwa.o4.com 
SMTP_PASSWORD=uppO;spEi!QUz+S}g-0< 
SMTP_SECURE=false

When inspecting the page I notice that the variables are being defined:

image

baptisteArno avatar Sep 22 '23 06:09 baptisteArno

The solution:

Thank you very much, I managed to solve it. all that was left to do was add the following headers on nginx.

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

follow the complete nginx file:

server{ server_name typebot.fairness.com.br; listen 443 ssl; ssl_certificate /etc/letsencrypt/live/typebot.fairness.com.br/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/typebot.fairness.com.br/privkey.pem; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:8080/; } }

baptisteArno avatar Dec 18 '23 08:12 baptisteArno

What do I need to do if I use nginx proxy manager? I don't understand, but I have a similar problem.

ezhkov-ph avatar Mar 09 '24 07:03 ezhkov-ph

What do I need to do if I use nginx proxy manager? I don't understand, but I have a similar problem.

I don't know, I'm not familiar with that

baptisteArno avatar Mar 11 '24 08:03 baptisteArno

https://docs.typebot.io/self-hosting/deploy/manual#nginx-configuration

baptisteArno avatar Jun 26 '24 14:06 baptisteArno