CORS failed when deploy with enterprise helm chart #22090

Closed
opened 2026-02-21 20:15:44 -05:00 by yindo · 2 comments
Owner

Originally created by @Sotatek-HuyTran16 on GitHub (Feb 5, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.8.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Environment:

Deployment Configuration

  • Dify was deployed using the Helm chart with a custom values.yaml Here
  • dify-web is disable, only dify-enterprise-frontend is enabled

Gateway custom:

  • The deployment use dify-gateway (Caddy) as the reverse proxy
  • Since dify-web is disable, all config in caddy file are replaced with dify-enterprise-frontend

Access method:

  • Access with nodeport type for debug
  • I tried service type LoadBalancer with MetalLB and correct port but also the same

✔️ Expected Behavior

The Dify app in cluster UI is work normally

Actual Behavior

The UI when access gateway is loading:

Image

The UI when access frontend web is CORS failed:

Image
Originally created by @Sotatek-HuyTran16 on GitHub (Feb 5, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce Environment: - Dify Helm chart version: 3.5.6 - Downloaded from: https://langgenius.github.io/dify-helm/#/pages/3_5_6 - Kubernetes distribution: Canonical Kubernetes - Cluster type: Fully air-gapped (no Internet access) - Container registry: Private Harbor registry Deployment Configuration - Dify was deployed using the Helm chart with a custom `values.yaml` [Here](https://github.com/Sotatek-HuyTran16/CTC_Redis-Qdrant/blob/main/deploy/dify/values.yaml) - dify-web is disable, only dify-enterprise-frontend is enabled Gateway custom: - The deployment use dify-gateway (Caddy) as the reverse proxy - Since dify-web is disable, all config in caddy file are replaced with dify-enterprise-frontend Access method: - Access with nodeport type for debug - I tried service type LoadBalancer with MetalLB and correct port but also the same ### ✔️ Expected Behavior The Dify app in cluster UI is work normally ### ❌ Actual Behavior The UI when access gateway is loading: <img width="1740" height="568" alt="Image" src="https://github.com/user-attachments/assets/a8a1cd8f-2463-4fc4-969a-1e04d02ce0e3" /> The UI when access frontend web is CORS failed: <img width="1735" height="932" alt="Image" src="https://github.com/user-attachments/assets/a8465dec-739a-482b-9a39-fadccb3f2d07" />
yindo added the 🐞 bug label 2026-02-21 20:15:44 -05:00
yindo closed this issue 2026-02-21 20:15:44 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 5, 2026):

Hi @Sotatek-HuyTran16! I'm Dosu and I’m helping the dify team.

Your CORS failures are almost certainly due to missing or misconfigured CORS headers in your Caddy (gateway) reverse proxy setup. When dify-web is disabled and only dify-enterprise-frontend is enabled, CORS must be explicitly handled by the gateway or backend—neither the frontend nor the default Helm chart will set these headers for you. The backend does support CORS via environment variables, but if your proxy strips or fails to forward the right headers, preflight (OPTIONS) requests will fail and the UI will not load correctly [source].

To resolve this:

  1. In your Caddyfile, ensure you add a CORS handler for all API endpoints accessed by the frontend. For example:

    handle_path /console/api/* {
        header Access-Control-Allow-Origin "http://YOUR_FRONTEND_ORIGIN"
        header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, PATCH"
        header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With"
        header Access-Control-Allow-Credentials "true"
        @options {
            method OPTIONS
        }
        respond @options 204
        reverse_proxy http://dify-backend:5001
    }
    

    Replace http://YOUR_FRONTEND_ORIGIN with the exact protocol, host, and port your browser uses to access the frontend.

  2. Set the backend environment variables WEB_API_CORS_ALLOW_ORIGINS and CONSOLE_CORS_ALLOW_ORIGINS to the same frontend origin (not *). This ensures the backend also responds with the correct CORS headers [source].

  3. Use HTTPS for both frontend and backend to avoid browser cookie and CORS issues, especially with Secure cookies.

  4. Make sure your frontend and backend are on the same domain or subdomain, or set the cookie domain and CORS origins accordingly.

If you still see blank pages or 0-byte responses, double-check your Caddy reverse proxy rules to ensure requests are being forwarded to the correct upstream and that CORS headers are not being stripped or blocked.

If you can share your current Caddyfile (with sensitive info redacted), I can help review it for any missing CORS or proxy settings.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 5, 2026): <!-- Greeting --> Hi @Sotatek-HuyTran16! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> Your CORS failures are almost certainly due to missing or misconfigured CORS headers in your Caddy (gateway) reverse proxy setup. When dify-web is disabled and only dify-enterprise-frontend is enabled, CORS must be explicitly handled by the gateway or backend—neither the frontend nor the default Helm chart will set these headers for you. The backend does support CORS via environment variables, but if your proxy strips or fails to forward the right headers, preflight (OPTIONS) requests will fail and the UI will not load correctly [[source]](https://github.com/langgenius/dify-docs/issues/521#issuecomment-3530600096). To resolve this: 1. In your Caddyfile, ensure you add a CORS handler for all API endpoints accessed by the frontend. For example: ``` handle_path /console/api/* { header Access-Control-Allow-Origin "http://YOUR_FRONTEND_ORIGIN" header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, PATCH" header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With" header Access-Control-Allow-Credentials "true" @options { method OPTIONS } respond @options 204 reverse_proxy http://dify-backend:5001 } ``` Replace `http://YOUR_FRONTEND_ORIGIN` with the exact protocol, host, and port your browser uses to access the frontend. 2. Set the backend environment variables `WEB_API_CORS_ALLOW_ORIGINS` and `CONSOLE_CORS_ALLOW_ORIGINS` to the same frontend origin (not `*`). This ensures the backend also responds with the correct CORS headers [[source]](https://github.com/langgenius/dify-docs/issues/521#issuecomment-3530600096). 3. Use HTTPS for both frontend and backend to avoid browser cookie and CORS issues, especially with Secure cookies. 4. Make sure your frontend and backend are on the same domain or subdomain, or set the cookie domain and CORS origins accordingly. If you still see blank pages or 0-byte responses, double-check your Caddy reverse proxy rules to ensure requests are being forwarded to the correct upstream and that CORS headers are not being stripped or blocked. If you can share your current Caddyfile (with sensitive info redacted), I can help review it for any missing CORS or proxy settings. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fc67b5ca-cc80-4ab6-a977-59eea2a8669d?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Your%20CORS%20failures%20are%20almost%20certainly%20due%20to%20missing%20or%20misconfigured%20CORS%20headers%20in%20your%20Caddy%20%28gateway%29%20reverse%20proxy%20setup.%20When%20dify-web%20is%20disabled%20and%20only%20dify-enterprise-frontend%20is%20enabled%2C%20CORS%20must%20be%20explicitly%20handled%20by%20the%20gateway%20or%20backend%E2%80%94neither%20the%20frontend%20nor%20the%20default%20Helm%20chart%20will%20set%20these%20headers%20for%20you.%20The%20backend%20does%20support%20CORS%20via%20environment%20variables%2C%20but%20if%20your%20proxy%20strips%20or%20fails%20to%20forward%20the%20right%20headers%2C%20preflight%20%28OPTIONS%29%20requests%20will%20fail%20and%20the%20UI%20will%20not%20load%20correctly%20%5B%5Bsource%5D%5D%28https%3A//github.com/langgenius/dify-docs/issues/521%23issuecomment-3530600096%29.%0A%0ATo%20resolve%20this%3A%0A%0A1.%20In%20your%20Caddyfile%2C%20ensure%20you%20add%20a%20CORS%20handler%20for%20all%20API%20endpoints%20accessed%20by%20the%20frontend.%20For%20example%3A%0A%20%20%20%60%60%60%0A%20%20%20handle_path%20/console/api/%2A%20%7B%0A%20%20%20%20%20%20%20header%20Access-Control-Allow-Origin%20%22http%3A//YOUR_FRONTEND_ORIGIN%22%0A%20%20%20%20%20%20%20header%20Access-Control-Allow-Methods%20%22GET%2C%20POST%2C%20PUT%2C%20DELETE%2C%20OPTIONS%2C%20PATCH%22%0A%20%20%20%20%20%20%20header%20Access-Control-Allow-Headers%20%22Authorization%2C%20Content-Type%2C%20X-Requested-With%22%0A%20%20%20%20%20%20%20header%20Access-Control-Allow-Credentials%20%22true%22%0A%20%20%20%20%20%20%20%40options%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20method%20OPTIONS%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20respond%20%40options%20204%0A%20%20%20%20%20%20%20reverse_proxy%20http%3A//dify-backend%3A5001%0A%20%20%20%7D%0A%20%20%20%60%60%60%0A%20%20%20Replace%20%60http%3A//YOUR_FRONTEND_ORIGIN%60%20with%20the%20exact%20protocol%2C%20host%2C%20and%20port%20your%20browser%20uses%20to%20access%20the%20frontend.%0A%0A2.%20Set%20the%20backend%20environment%20variables%20%60WEB_API_CORS_ALLOW_ORIGINS%60%20and%20%60CONSOLE_CORS_ALLOW_ORIGINS%60%20to%20the%20same%20frontend%20origin%20%28not%20%60%2A%60%29.%20This%20ensures%20the%20backend%20also%20responds%20with%20the%20correct%20CORS%20headers%20%5B%5Bsource%5D%5D%28https%3A//github.com/langgenius/dify-docs/issues/521%23issuecomment-3530600096%29.%0A%0A3.%20Use%20HTTPS%20for%20both%20frontend%20and%20backend%20to%20avoid%20browser%20cookie%20and%20CORS%20issues%2C%20especially%20with%20Secure%20cookies.%0A%0A4.%20Make%20sure%20your%20frontend%20and%20backend%20are%20on%20the%20same%20domain%20or%20subdomain%2C%20or%20set%20the%20cookie%20domain%20and%20CORS%20origins%20accordingly.%0A%0AIf%20you%20still%20see%20blank%20pages%20or%200-byte%20responses%2C%20double-check%20your%20Caddy%20reverse%20proxy%20rules%20to%20ensure%20requests%20are%20being%20forwarded%20to%20the%20correct%20upstream%20and%20that%20CORS%20headers%20are%20not%20being%20stripped%20or%20blocked.%0A%0AIf%20you%20can%20share%20your%20current%20Caddyfile%20%28with%20sensitive%20info%20redacted%29%2C%20I%20can%20help%20review%20it%20for%20any%20missing%20CORS%20or%20proxy%20settings.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/31993)
Author
Owner

@crazywoola commented on GitHub (Feb 5, 2026):

Hi @Sotatek-HuyTran16, thanks for opening this issue.\n\n### Why this is being closed\n

  • This report is about the enterprise Helm chart / enterprise deployment.
  • The report indicates Self Hosted (Source), which we do not provide technical support for.
  • The reported Dify version is 1.8.2, which is below v1.10.0.

Next steps

  • Please reach out to our business@dify.ai or submit a report via Zendesk.\n
  • We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.\n
  • Please upgrade to the latest Dify release and retest. If the issue persists on the latest version, feel free to open a new issue with updated details.
@crazywoola commented on GitHub (Feb 5, 2026): Hi @Sotatek-HuyTran16, thanks for opening this issue.\n\n### Why this is being closed\n - This report is about the enterprise Helm chart / enterprise deployment. - The report indicates **Self Hosted (Source)**, which we do not provide technical support for. - The reported Dify version is 1.8.2, which is below v1.10.0. ### Next steps - Please reach out to our business@dify.ai or submit a report via Zendesk.\n - We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.\n - Please upgrade to the latest Dify release and retest. If the issue persists on the latest version, feel free to open a new issue with updated details.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22090