Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chat-ui behind nginx proxy #1626

Open
ljw20180420 opened this issue Dec 12, 2024 · 2 comments
Open

Use chat-ui behind nginx proxy #1626

ljw20180420 opened this issue Dec 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ljw20180420
Copy link

ljw20180420 commented Dec 12, 2024

Bug description

I use ghcr.io/huggingface/chat-ui-db:latest behind nginx:latest. My nginx.conf is

client_max_body_size 10G;

server {
    listen 80 default_server;
    # listen 443 ssl default_server;
    server_name localhost qiangwulab.sjtu.edu.cn www.qiangwulab.sjtu.edu.cn;

    root /usr/share/nginx/html;
    
    location / {
        index homepage.html;
    }

    location /favicon.ico/ {
        index favicon.ico;
    }

    location /chat-ui-db/ {
        proxy_pass http://chat-ui-db:3000/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Prefix /chat-ui-db/;
    }
}

It works well until I pull ghcr.io/huggingface/chat-ui-db:latest to update it to the latest version. When I visit ChatUI by http://localhost/chat-ui-db/ (the subpath set in nginx.conf), I got the following errors in the firefox console.

GET
http://localhost/_app/immutable/assets/0.DaJefZZS.css
[HTTP/1.1 404 Not Found 1ms]

GET
http://localhost/_app/immutable/chunks/trash-can.DVxvIpt1.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/Modal.BkbMR74H.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/nodes/6.Do_AzQDj.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/pendingMessage.BLZ1hoA9.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/Switch.DLwPPHY0.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/Tool.DhGHvanO.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/clickOutside.D-5j4fJ8.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/isHuggingChat.CIE65YXf.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/image.C9cv8lb-.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/models.DroIo2EZ.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/user-multiple.BXwB7QM2.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/IconInternet.BkJSosd-.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/CopyToClipBoardBtn.BlbrNBhY.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/tools.j09xioNF.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/forms.KqItQYES.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/pen.DQt029I2.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/_commonjsHelpers.Cpj98o6Y.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/arrow-up-right.BMt4VElx.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/marked.esm.LTwExiil.js
NS_ERROR_CORRUPTED_CONTENT

GET
http://localhost/_app/immutable/chunks/code.CRoxvYut.js
NS_ERROR_CORRUPTED_CONTENT

Loading module from “http://localhost/_app/immutable/entry/start.DBc6rYrC.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/entry.CdBDLxbE.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/scheduler.CeakrPJD.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/control.CYgJF_JY.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/entry/app.DFwm9KqU.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Uncaught (in promise) TypeError: error loading dynamically imported module: http://localhost/_app/immutable/entry/start.DBc6rYrC.js
Loading module from “http://localhost/_app/immutable/chunks/13.CPQgNjit.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/index.Cljt5KuQ.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/nodes/0.X1QXwHom.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/stores.J8_b9NpQ.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/public.DR_Jguxv.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/cookiesAreEnabled.v8vFKDFT.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/isDesktop.Bkn--V8t.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/settings.DM-K-rkp.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/titleUpdate.PKSaXYcL.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/index.Bq3K2eeF.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/await_block.B9GGS9dX.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/each.BIi1aKAa.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/checkmark.6owcNWDl.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/trash-can.DVxvIpt1.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/close.cHgTbNHl.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/Modal.BkbMR74H.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/nodes/6.Do_AzQDj.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/pendingMessage.BLZ1hoA9.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/Tool.DhGHvanO.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/Switch.DLwPPHY0.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/clickOutside.D-5j4fJ8.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/isHuggingChat.CIE65YXf.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/image.C9cv8lb-.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/models.DroIo2EZ.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/user-multiple.BXwB7QM2.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/IconInternet.BkJSosd-.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/tools.j09xioNF.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/CopyToClipBoardBtn.BlbrNBhY.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/pen.DQt029I2.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/forms.KqItQYES.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/_commonjsHelpers.Cpj98o6Y.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/marked.esm.LTwExiil.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/arrow-up-right.BMt4VElx.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
Loading module from “http://localhost/_app/immutable/chunks/code.CRoxvYut.js” was blocked because of a disallowed MIME type (“text/html”).
[chat-ui-db](http://localhost/chat-ui-db/)
GET
http://localhost/chatui/apple-touch-icon.png
[HTTP/1.1 404 Not Found 0ms]

GET
http://localhost/chatui/icon.svg

It works nicely if I visit it through localhost:3000. I map port of chat-ui-db in the docker compose file.

services:
  nginx:
    depends_on:
      - chat-ui-db
    restart: always
    container_name: nginx_server
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - "./docker-images/nginx/conf:/etc/nginx/conf.d"
      - "./docker-images/nginx/html:/usr/share/nginx/html"
    # command: [nginx-debug, '-g', 'daemon off;']

  chat-ui-db:
    depends_on:
      - Phi-3-mini-4k-instruct-gguf
    restart: always
    container_name: chat-ui-db
    image: ghcr.io/huggingface/chat-ui-db:latest
    volumes:
      - "./docker-images/chat-ui/.env.local:/app/.env.local"
      - "./docker-images/chat-ui/data:/data"
    ports:
      - "3000:3000"

  Phi-3-mini-4k-instruct-gguf:
    restart: always
    container_name: Phi-3-mini-4k-instruct-gguf
    image: ghcr.io/ggerganov/llama.cpp:server
    volumes:
      - "./docker-images/chat-ui/llama.cpp:/models"
    command: -m /models/Phi-3-mini-4k-instruct-q4.gguf --host 0.0.0.0 -c 4096

Steps to reproduce

Screenshots

Context

Logs

// logs here if relevant

Specs

  • ubuntu 24.04:
  • firefox:
  • ghcr.io/huggingface/chat-ui-db:latest

Config

My .env.local is

MODELS=`[
  {
    "name": "microsoft/Phi-3-mini-4k-instruct-gguf",
    "tokenizer": "microsoft/Phi-3-mini-4k-instruct-gguf",
    "preprompt": "",
    "chatPromptTemplate": "<s>{{preprompt}}{{#each messages}}{{#ifUser}}<|user|>\n{{content}}<|end|>\n<|assistant|>\n{{/ifUser}}{{#ifAssistant}}{{content}}<|end|>\n{{/ifAssistant}}{{/each}}",
    "parameters": {
      "stop": ["<|end|>", "<|endoftext|>", "<|assistant|>"],
      "temperature": 0.7,
      "max_new_tokens": 1024,
      "truncate": 3071
    },
    "endpoints": [{
      "type" : "llamacpp",
      "baseURL": "http://Phi-3-mini-4k-instruct-gguf:8080",
      "accessToken": "abc"
    }],
  },
]`

# PUBLIC_ORIGIN="http://qiangwulab.sjtu.edu.cn"
PUBLIC_ORIGIN="http://localhost"

Notes

@ljw20180420 ljw20180420 added the bug Something isn't working label Dec 12, 2024
@chichur
Copy link

chichur commented Dec 12, 2024

You need to build an application docker build --build-arg APP_BASE=/prefix .
Similar issue #1612

@ljw20180420
Copy link
Author

It works previously but not now. Will this be fixed in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants