dify icon indicating copy to clipboard operation
dify copied to clipboard

Nginx template not replace correctly in docker compose

Open LiuBodong opened this issue 1 year ago • 1 comments

Self Checks

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

Dify version

1.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. cd docker
  2. docker compose up -d
  3. check docker/nginx/conf.d/default.conf

Image

✔️ Expected Behavior

location /e/ {
  proxy_pass http://plugin_daemon:5002;
  proxy_set_header Dify-Hook-Url $scheme://$host$request_uri;
  include proxy.conf;
}

❌ Actual Behavior

location /e/ {
  proxy_pass http://plugin_daemon:5002;
  proxy_set_header Dify-Hook-Url ://;
  include proxy.conf;
}

LiuBodong avatar Mar 12 '25 11:03 LiuBodong

The issue you're experiencing with the Nginx template not replacing placeholders correctly in the Docker Compose setup might be related to how environment variables or placeholders are processed during the configuration generation.

In the Dify Docker setup, the Nginx configuration is generated using template files and a script (docker-entrypoint.sh) that processes these templates. The placeholders like $scheme, $host, and $request_uri should be replaced by Nginx itself during runtime, not during the template processing. If they are not being replaced correctly, it might be due to a misconfiguration in the template or the way the script is handling the template files.

Here are a few things you can check or try:

  1. Ensure Correct Template Syntax: Verify that the placeholders in your Nginx template files are correctly formatted. They should be written as $scheme, $host, and $request_uri without any additional characters or spaces.

  2. Check Entrypoint Script: Make sure that the docker-entrypoint.sh script is correctly copying and processing the template files. Any errors in this script could lead to incorrect configuration generation.

  3. Environment Variables: Ensure that any environment variables used in the template are correctly set and accessible to the Nginx container.

  4. Nginx Configuration: Double-check the Nginx configuration to ensure that it is set up to handle these variables correctly. The placeholders should be part of the Nginx runtime configuration and not replaced during the template processing.

If these steps do not resolve the issue, you might want to look into the specific logic within the docker-entrypoint.sh script or any related configuration files to ensure they are functioning as expected.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 12 '25 11:03 dosubot[bot]