Skip to content

如何配置才能使得通过nginx的域名+path(比如:https://my.com/dify)进行代理访问到dify #13735

Description

@xyfZzz

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

目前我参考了issue中的一些历史答复,将域名对应的nginx进行了配置:

server {
    listen 80;
    server_name my.com;

    location /dify/ {
        proxy_pass http://127.0.0.1:8090/;
        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_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Prefix /dify;
        rewrite ^/dify/(.*)$ /$1 break;
    }
}

并且在.env中的如下一些变量进行了设置:

CONSOLE_API_URL=https://my.com/dify/api
CONSOLE_WEB_URL=https://my.com/dify
SERVICE_API_URL=https://my.com/dify/service
APP_API_URL=https://my.com/dify/app
APP_WEB_URL=https://my.com/dify

并对dify通过docker compose部署后,依旧无法通过https://my.com/dify/install或https://my.com/dify/apps正常访问到dify。

目前网页报错,访问js和css静态文件时还是去访问https://my.com/_next/...导致返回304错误,而不是访问https://my.com/dify/_next/...

请问有没有正确的操作案例可供参考?还是说目前还有bug?

✔️ Expected Behavior

希望通过https://my.com/dify/install成功访问到dify

❌ Actual Behavior

目前网页报错,访问js和css静态文件时还是去访问https://my.com/_next/...导致返回304错误,而不是访问https://my.com/dify/_next/...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions