[Failed Regression Test] Dify doesn't work behind ingress since 0.3.8 #305

Closed
opened 2026-02-21 17:26:43 -05:00 by yindo · 5 comments
Owner

Originally created by @BorisPolonsky on GitHub (Jul 26, 2023).

Front end works in 0.3.1 behind ingress, while it stuck in loading phase since 0.3.8. We aim to improve compatibility of dify-helm.
Dify version: Self Host

Steps To Reproduce

  1. Add helm repo
helm repo add dify https://borispolonsky.github.io/dify-helm
helm repo update
  1. Install dify with ingress enabled. Modify image and ingress section in in values.yaml as follow
helm install -n test test dify/dify --create-namespace -f <modified-values.yaml>

Part 1 (Image)

image:
  api:
    repository: langgenius/dify-api
-   tag: 0.3.1
+   tag: 0.3.8
    pullPolicy: IfNotPresent
    ## Optionally specify an array of imagePullSecrets.
    ## Secrets must be manually created in the namespace.
    ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
    ##
    # pullSecrets:
    #   - myRegistryKeySecretName
  web:    
    repository: langgenius/dify-web
-   tag: 0.3.1
+   tag: 0.3.8
    pullPolicy: IfNotPresent
    ## Optionally specify an array of imagePullSecrets.
    ## Secrets must be manually created in the namespace.
    ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
    ##
    # pullSecrets:
    #   - myRegistryKeySecretName

Part 2 (Ingress)

ingress:
-  enabled: false
+  enabled: true
-  className: ""
+  className: "nginx"
  annotations: #{}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
-   # nginx.ingress.kubernetes.io/backend-protocol: HTTP
-   # nginx.ingress.kubernetes.io/proxy-body-size: 15m
-   # nginx.ingress.kubernetes.io/ssl-redirect: "true"
+   nginx.ingress.kubernetes.io/backend-protocol: HTTP
+   nginx.ingress.kubernetes.io/proxy-body-size: 15m
+   nginx.ingress.kubernetes.io/ssl-redirect: "true"
  hosts:
    - host: localhost
      paths:
        - path: /
          pathType: ImplementationSpecific

The current behavior

With chrome debugger we would observe multiple attempt to access an invalid endpoint 127.0.0.1:5001
image

The expected behavior

Front end should work as is in 0.3.1 with the very same configuration. (i.e. to modify Part 2 only in steps illustrated above)
image

Originally created by @BorisPolonsky on GitHub (Jul 26, 2023). <!-- Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest version of the relevant Dify packages to make sure your issue has not already been fixed. --> Front end works in `0.3.1` behind ingress, while it stuck in loading phase since `0.3.8`. We aim to improve compatibility of [dify-helm](https://github.com/BorisPolonsky/dify-helm). Dify version: Self Host ## Steps To Reproduce <!-- Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than Dify. Issues without reproduction steps or code examples may be immediately closed as not actionable. --> 1. Add helm repo ``` helm repo add dify https://borispolonsky.github.io/dify-helm helm repo update ``` 2. Install dify with ingress enabled. Modify `image` and `ingress` section in in `values.yaml` as follow ``` helm install -n test test dify/dify --create-namespace -f <modified-values.yaml> ``` Part 1 (Image) ```diff image: api: repository: langgenius/dify-api - tag: 0.3.1 + tag: 0.3.8 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: # - myRegistryKeySecretName web: repository: langgenius/dify-web - tag: 0.3.1 + tag: 0.3.8 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: # - myRegistryKeySecretName ``` Part 2 (Ingress) ```diff ingress: - enabled: false + enabled: true - className: "" + className: "nginx" annotations: #{} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - # nginx.ingress.kubernetes.io/backend-protocol: HTTP - # nginx.ingress.kubernetes.io/proxy-body-size: 15m - # nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/backend-protocol: HTTP + nginx.ingress.kubernetes.io/proxy-body-size: 15m + nginx.ingress.kubernetes.io/ssl-redirect: "true" hosts: - host: localhost paths: - path: / pathType: ImplementationSpecific ``` ## The current behavior With chrome debugger we would observe multiple attempt to access an invalid endpoint `127.0.0.1:5001` ![image](https://github.com/langgenius/dify/assets/12964401/3fee9b32-94b7-456d-b4cb-3fcd53e4f693) ## The expected behavior Front end should work as is in `0.3.1` with the very same configuration. (i.e. to modify Part 2 only in steps illustrated above) ![image](https://github.com/langgenius/dify/assets/12964401/6b8d0640-19b9-4b68-a9e7-67fa29be422c)
yindo closed this issue 2026-02-21 17:26:43 -05:00
Author
Owner

@BorisPolonsky commented on GitHub (Jul 26, 2023):

Not working in0.3.9 either
image

@BorisPolonsky commented on GitHub (Jul 26, 2023): Not working in`0.3.9` either ![image](https://github.com/langgenius/dify/assets/12964401/d531cde0-8093-48ba-b325-461384db8b54)
Author
Owner

@takatost commented on GitHub (Jul 26, 2023):

In 0.3.8, we split CONSOLE_URL / APP_URL / API_URL into separate environment variables for the frontend and backend. However, we still support and maintain compatibility with the previous environment variables as fallback. Could you please try using the new environment variables to see if they work correctly?
https://docs.dify.ai/getting-started/install-self-hosted/environments

@takatost commented on GitHub (Jul 26, 2023): In 0.3.8, we split CONSOLE_URL / APP_URL / API_URL into separate environment variables for the frontend and backend. However, we still support and maintain compatibility with the previous environment variables as fallback. Could you please try using the new environment variables to see if they work correctly? https://docs.dify.ai/getting-started/install-self-hosted/environments
Author
Owner

@BorisPolonsky commented on GitHub (Jul 27, 2023):

In 0.3.8, we split CONSOLE_URL / APP_URL / API_URL into separate environment variables for the frontend and backend. However, we still support and maintain compatibility with the previous environment variables as fallback. Could you please try using the new environment variables to see if they work correctly? https://docs.dify.ai/getting-started/install-self-hosted/environments

We've identified the source of the invalid entry.
When leaving the three URL's as empty string in 3.8.0

kubectl exec -it -n test test-dify-api-788b7c499b-s7srx -- env | grep URL
CHECK_UPDATE_URL=
CELERY_BROKER_URL=redis://:difyai123456@test-redis-master:6379/1
PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py
CONSOLE_API_URL=http://127.0.0.1:5001
CONSOLE_WEB_URL=http://127.0.0.1:3000
SERVICE_API_URL=http://127.0.0.1:5001
APP_API_URL=http://127.0.0.1:5001
APP_WEB_URL=http://127.0.0.1:3000
kubectl exec -it -n test test-dify-web-5669c469bf-t4vfm -- env | grep URL
CONSOLE_URL=
APP_URL=
PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py
CONSOLE_API_URL=http://127.0.0.1:5001
APP_API_URL=http://127.0.0.1:5001

We did notice the backward compatibility attempt defined here.
Note that CONSOLE_URL takes higher priority than CONSOLE_API_URL and CONSOLE_WEB_URL.

self.CONSOLE_API_URL = get_env('CONSOLE_URL') if get_env('CONSOLE_URL') else get_env('CONSOLE_API_URL')
self.CONSOLE_WEB_URL = get_env('CONSOLE_URL') if get_env('CONSOLE_URL') else get_env('CONSOLE_WEB_URL')

So here's what happens. When CONSOLE_URL is set as empty string, which is the default set up in the previous version (with docker-compose and helm install, CONSOLE_API_URL and CONSOLE_WEB_URL will take place since 0.3.8, and the default values of these two substitutional variables are not empty, which is inconsistent with previous release, thus breaking the backward compatability.

Here'w what URL related environment variable look like in 0.3.1

kubectl exec -it  -n test test-dify-api-d95986db5-mjdtm -- env | grep URL
CELERY_BROKER_URL=redis://:difyai123456@test-redis-master:6379/1
CHECK_UPDATE_URL=
API_URL=
CONSOLE_URL=
APP_URL=
PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py
kubectl exec -it  -n test test-dify-web-847cbb5d68-mwq55 -- env | grep URL
CONSOLE_URL=
APP_URL=
PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py
@BorisPolonsky commented on GitHub (Jul 27, 2023): > In 0.3.8, we split CONSOLE_URL / APP_URL / API_URL into separate environment variables for the frontend and backend. However, we still support and maintain compatibility with the previous environment variables as fallback. Could you please try using the new environment variables to see if they work correctly? https://docs.dify.ai/getting-started/install-self-hosted/environments We've identified the source of the invalid entry. When leaving the three URL's as empty string in `3.8.0` ``` kubectl exec -it -n test test-dify-api-788b7c499b-s7srx -- env | grep URL CHECK_UPDATE_URL= CELERY_BROKER_URL=redis://:difyai123456@test-redis-master:6379/1 PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py CONSOLE_API_URL=http://127.0.0.1:5001 CONSOLE_WEB_URL=http://127.0.0.1:3000 SERVICE_API_URL=http://127.0.0.1:5001 APP_API_URL=http://127.0.0.1:5001 APP_WEB_URL=http://127.0.0.1:3000 ``` ``` kubectl exec -it -n test test-dify-web-5669c469bf-t4vfm -- env | grep URL CONSOLE_URL= APP_URL= PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py CONSOLE_API_URL=http://127.0.0.1:5001 APP_API_URL=http://127.0.0.1:5001 ``` We did notice the backward compatibility attempt defined [here](https://github.com/langgenius/dify/blob/741e9303d454b2e1c288b014fe02432ac046a805/api/config.py#L85-L90). Note that `CONSOLE_URL` takes higher priority than `CONSOLE_API_URL` and `CONSOLE_WEB_URL`. ``` self.CONSOLE_API_URL = get_env('CONSOLE_URL') if get_env('CONSOLE_URL') else get_env('CONSOLE_API_URL') self.CONSOLE_WEB_URL = get_env('CONSOLE_URL') if get_env('CONSOLE_URL') else get_env('CONSOLE_WEB_URL') ``` So here's what happens. When `CONSOLE_URL` is set as empty string, which is the default set up in the previous version (with `docker-compose` and `helm install`, `CONSOLE_API_URL` and `CONSOLE_WEB_URL` will take place since `0.3.8`, and the default values of these two substitutional variables are not empty, which is inconsistent with previous release, thus breaking the backward compatability. Here'w what URL related environment variable look like in `0.3.1` ``` kubectl exec -it -n test test-dify-api-d95986db5-mjdtm -- env | grep URL CELERY_BROKER_URL=redis://:difyai123456@test-redis-master:6379/1 CHECK_UPDATE_URL= API_URL= CONSOLE_URL= APP_URL= PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py ``` ``` kubectl exec -it -n test test-dify-web-847cbb5d68-mwq55 -- env | grep URL CONSOLE_URL= APP_URL= PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/d5cb0afaf23b8520f1bbcfed521017b4a95f5c01/public/get-pip.py ```
Author
Owner

@BorisPolonsky commented on GitHub (Jul 27, 2023):

We've updated the chart. Feel free to evaluate if it's propriate or not given its current design. @takatost

@BorisPolonsky commented on GitHub (Jul 27, 2023): We've updated the [chart](https://github.com/BorisPolonsky/dify-helm/pull/14). Feel free to evaluate if it's propriate or not given its current design. @takatost
Author
Owner

@takatost commented on GitHub (Jul 27, 2023):

We've updated the chart. Feel free to evaluate if it's propriate or not given its current design. 我们更新了图表。请随意评估它是否适合当前的设计。@takatost

Oh, I got it. It's because the values for CONSOLE_URL were originally empty, my bad.
I split these parameters into web and api because the frontend and backend services are on different domains. In some cases, we need to separately retrieve the domain names for web and api. So, I split them. Maybe you can also split them into two domain names corresponding to the frontend and backend in your chart?

@takatost commented on GitHub (Jul 27, 2023): > We've updated the [chart](https://github.com/BorisPolonsky/dify-helm/pull/14). Feel free to evaluate if it's propriate or not given its current design. 我们更新了图表。请随意评估它是否适合当前的设计。@takatost Oh, I got it. It's because the values for `CONSOLE_URL` were originally empty, my bad. I split these parameters into web and api because the frontend and backend services are on different domains. In some cases, we need to separately retrieve the domain names for `web` and `api`. So, I split them. Maybe you can also split them into two domain names corresponding to the frontend and backend in your chart?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#305