chat-ui icon indicating copy to clipboard operation
chat-ui copied to clipboard

Chat-UI throws an 403 forbidden when access settings

Open IT-Guy007 opened this issue 2 years ago • 5 comments

When viewing the settings page after first setup the settings page fives the error: Failed to load resource: the server responded with a status of 403 (Forbidden) settings:1 in the console. Without any explanation of what and why.

Setup:

services:
  # Chat ui webserver
  chat-ui:
    container_name: chat
    build:
      context: ./
      dockerfile: Dockerfile
    ports:
      - 8080:3000
    networks:
      default:
        ipv4_address: 172.25.0.2

  # Mongo database      
  database:
    container_name: mongo-chatui
    image: "mongo:latest"
    ports:
      - 27017:27017
    restart: always
    environment:
      - MONGO_INITDB_DATABASE=chat-ui
    networks:
      default:
        ipv4_address: 172.25.0.3

networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.25.0.0/28
          gateway: 172.25.0.1

And my .env.local:

MONGODB_URL=mongodb://172.25.0.3:27017
PUBLIC_ORIGIN=http://localhost:3030
HF_ACCESS_TOKEN=recacted
MODELS=recated

What are the steps to take here?

The database connections gets accepted according to the mongoDB instance

IT-Guy007 avatar Nov 06 '23 15:11 IT-Guy007

Not sure if this is the issue but your port in your PUBLIC_ORIGIN is different than your port in your docker compose file. Can you try fixing that to see if it works ?

nsarrazin avatar Nov 15 '23 16:11 nsarrazin

I tried replicating a similar docker setup and don't have this issue so I think your PUBLIC_ORIGIN might be wrong here

nsarrazin avatar Nov 15 '23 16:11 nsarrazin

Hi, tried that as well, but still got the same error.

IT-Guy007 avatar Nov 20 '23 09:11 IT-Guy007

Hi, I am running a similar setup, without docker; I have the chat-ui app on an ec2 running on node as PORT=80 HOST=0.0.0.0 node build/index.js my APP_BASE="" PUBLIC_ORIGIN=http://elasticip when I access http://elasticip/settings, I get 403

it does work with vite dev, though..

shanks-20million avatar Nov 27 '23 07:11 shanks-20million

Hi,

I am running a similar setup, without docker; I have the chat-ui app on an ec2 running on node as PORT=80 HOST=0.0.0.0 node build/index.js

my

APP_BASE=""

PUBLIC_ORIGIN=http://elasticip

when I access http://elasticip/settings, I get 403

it does work with vite dev, though..

Figured this out. I was serving the site without ssl. The cookie (hf-chat) being configured was set as secure cookie. Once I enabled ssl, the issue was sorted. The settings page came through without error.

shanks-20million avatar Dec 02 '23 05:12 shanks-20million