langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
46.84k stars 6.62k forks source link

docker dows not rewrite specific urls into the system #8819

Open mzramna opened 3 days ago

mzramna commented 3 days ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

create any agent, and try to run app other way to find this error is to create a new user and use the link showed

✔️ Expected Behavior

access the app to use as an embedded site access the user creation form

❌ Actual Behavior

this returns an 404 error, when analizing the network of the developer options it shows the browser trys to access an 127.0.0.1 address, even with all the url environment variables from the doc filled the right way into api, worker and web containers

dosubot[bot] commented 3 days ago

Hey @mzramna! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's squash those bugs together! 🤖

The 404 error you're encountering when trying to access the app or user creation form, despite correctly setting all URL environment variables, could be due to the Nginx reverse proxy configuration. Specifically, the NGINX_SERVER_NAME environment variable might be set incorrectly. Here are some steps to resolve this issue:

  1. Set Correct Domain Name: Ensure that the NGINX_SERVER_NAME is set to the correct domain name that matches the URLs you are trying to access. For example:

    NGINX_SERVER_NAME=your_domain.com
  2. Verify Port Settings: Ensure that the NGINX_PORT and EXPOSE_NGINX_PORT are correctly set to the ports you are using to access the application.

    NGINX_PORT=80
    EXPOSE_NGINX_PORT=80
  3. Configure HTTPS (if applicable): If HTTPS is enabled, ensure that the SSL certificates are correctly configured and the NGINX_SSL_PORT and EXPOSE_NGINX_SSL_PORT are set appropriately.

    NGINX_HTTPS_ENABLED=true
    NGINX_SSL_PORT=443
    EXPOSE_NGINX_SSL_PORT=443
  4. Set Environment Variables in docker-compose.yaml: Ensure that the environment variables for the API, worker, and web services are correctly set in the docker-compose.yaml file. For example:

    services:
      api:
        environment:
          CONSOLE_WEB_URL: ${CONSOLE_WEB_URL:-}
          CONSOLE_API_URL: ${CONSOLE_API_URL:-}
          SERVICE_API_URL: ${SERVICE_API_URL:-}
          APP_WEB_URL: ${APP_WEB_URL:-}
      web:
        environment:
          CONSOLE_API_URL: ${CONSOLE_API_URL:-}
          APP_API_URL: ${APP_API_URL:-}
  5. Configure CORS Settings: Ensure that the CORS settings are correctly configured to avoid cross-origin issues, which can also result in 404 errors. Update the docker-compose.yaml file with the correct domain names for the following environment variables:

    services:
      api:
        environment:
          CONSOLE_CORS_ALLOW_ORIGINS: ${CONSOLE_CORS_ALLOW_ORIGINS:-*}
          WEB_API_CORS_ALLOW_ORIGINS: ${WEB_API_CORS_ALLOW_ORIGINS:-*}
      web:
        environment:
          CONSOLE_API_URL: ${CONSOLE_API_URL:-}
          APP_API_URL: ${APP_API_URL:-}
  6. Use a .env File: Use a .env file to manage these environment variables persistently across deployments. For example:

    CONSOLE_API_URL=http://your_console_api_url
    SERVICE_API_URL=http://your_service_api_url
    APP_WEB_URL=http://your_app_web_url
    CONSOLE_CORS_ALLOW_ORIGINS=*
    WEB_API_CORS_ALLOW_ORIGINS=*

These configurations should help ensure that Nginx correctly routes the requests to the backend services, preventing the 404 errors [1][2][3][4].

To continue talking to Dosu, mention @dosu.

mzramna commented 3 days ago

the activate endpoint cannot be accesses, but to fix the localhost issue i was able to fix with the provided doc