The APP_API_URL configured in the .env file does not take effect, and the http://localhost:5001/api is always requested #7178

Closed
opened 2026-02-21 18:19:17 -05:00 by yindo · 2 comments
Owner

Originally created by @fsea on GitHub (Dec 12, 2024).

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.13.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The APP_API_URL configured in the .env file does not take effect, and the http://localhost:5001/api is always requested

✔️ Expected Behavior

Request an interface as configured in ENV

Actual Behavior

No response

Originally created by @fsea on GitHub (Dec 12, 2024). ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.13.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce The APP_API_URL configured in the .env file does not take effect, and the http://localhost:5001/api is always requested ### ✔️ Expected Behavior Request an interface as configured in ENV ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🌚 invalid labels 2026-02-21 18:19:17 -05:00
yindo closed this issue 2026-02-21 18:19:17 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 12, 2024):

The issue you're experiencing, where the APP_API_URL configured in the .env file does not take effect and defaults to http://localhost:5001/api, might be due to several reasons. Here are some steps to troubleshoot and resolve this:

  1. Ensure .env File is Loaded: Verify that the .env file is correctly placed and named in the root directory of your Docker setup. Docker Compose should automatically load this file.

  2. Check Docker Compose Configuration: Make sure that the docker-compose.yaml file is correctly referencing the environment variables. The APP_API_URL should be included in the environment section of the relevant service.

  3. Rebuild Docker Containers: After making changes to the .env file, you need to rebuild your Docker containers to ensure the new environment variables are applied. Use the following commands:

    docker-compose down
    docker-compose up --build
    
  4. Verify Environment Variable Usage: Double-check the application code to ensure that the APP_API_URL is being used correctly. It should be referenced in the code where the API requests are made.

  5. Check for Overrides: Ensure there are no scripts or entry points in the Docker setup that might override the APP_API_URL setting. This could be in the form of hardcoded values or additional configuration files.

By following these steps, you should be able to resolve the issue with the APP_API_URL not taking effect. If the problem persists, consider checking the logs for any errors or warnings that might provide more insight.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Dec 12, 2024): <!-- Answer --> The issue you're experiencing, where the `APP_API_URL` configured in the `.env` file does not take effect and defaults to `http://localhost:5001/api`, might be due to several reasons. Here are some steps to troubleshoot and resolve this: 1. **Ensure `.env` File is Loaded**: Verify that the `.env` file is correctly placed and named in the root directory of your Docker setup. Docker Compose should automatically load this file. 2. **Check Docker Compose Configuration**: Make sure that the `docker-compose.yaml` file is correctly referencing the environment variables. The `APP_API_URL` should be included in the `environment` section of the relevant service. 3. **Rebuild Docker Containers**: After making changes to the `.env` file, you need to rebuild your Docker containers to ensure the new environment variables are applied. Use the following commands: ```bash docker-compose down docker-compose up --build ``` 4. **Verify Environment Variable Usage**: Double-check the application code to ensure that the `APP_API_URL` is being used correctly. It should be referenced in the code where the API requests are made. 5. **Check for Overrides**: Ensure there are no scripts or entry points in the Docker setup that might override the `APP_API_URL` setting. This could be in the form of hardcoded values or additional configuration files. By following these steps, you should be able to resolve the issue with the `APP_API_URL` not taking effect. If the problem persists, consider checking the logs for any errors or warnings that might provide more insight. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/9e82ae04-8cdc-4e92-a112-7b379a8acc3c?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Dec 12, 2024):

If you are using docker, you will not see a port available.
Please see the docs as well. https://docs.dify.ai/getting-started/install-self-hosted/environments
Different env stands for different purposes.
You provided information isn't enough to guess what's happening.
For questions please use discussion instead.

@crazywoola commented on GitHub (Dec 12, 2024): If you are using docker, you will not see a port available. Please see the docs as well. https://docs.dify.ai/getting-started/install-self-hosted/environments Different env stands for different purposes. You provided information isn't enough to guess what's happening. For questions please use discussion instead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7178