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.75k stars 6.61k forks source link

when i call api it return 404 page not found #8810

Closed ClementeGao closed 2 days ago

ClementeGao commented 2 days ago

Self Checks

Dify version

latest

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

i had publish application, but can not access

image

✔️ Expected Behavior

return correct result

❌ Actual Behavior

404 page not found

dosubot[bot] commented 2 days ago

@ClementeGao Hello there! I'm here to help you with bug reports, answer questions, and assist you in becoming a contributor while we wait for a human maintainer.

The "404 page not found" error when calling the API with a POST request using a Bearer token authorization could be due to a misconfiguration in the domain/URL settings, causing cross-domain issues between the frontend and backend.

To resolve this, ensure that the following configuration items in docker-compose.yml are updated to the correct domain:

Additionally, verify the CORS configuration:

  1. CONSOLE_CORS_ALLOW_ORIGINS: Console CORS policy, default is *, meaning all domains can access.
  2. WEB_API_CORS_ALLOW_ORIGINS: WebAPP CORS policy, default is *, meaning all domains can access.

Ensure these configurations are correctly set to allow cross-domain requests.

If the issue persists, it might be due to switching the domain name/website, causing cross-domain issues between the front-end and server-side. Make sure to update all the relevant configuration items in docker-compose.yml to the new domain name.

If you encounter a "502 Bad Gateway" error, it might be due to Nginx forwarding requests to the wrong location. Ensure the containers are running and use the following command to get the correct IP addresses:

docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'

Update the Nginx configuration in dify/docker/nginx/conf.d with the correct IP addresses for api and web services, then restart the Nginx container or reload the configuration [1][2].

To continue talking to Dosu, mention @dosu.