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
47.15k stars 6.7k forks source link

Getting 405 Not Allowed from openresty #2132

Closed StreamlinedStartup closed 8 months ago

StreamlinedStartup commented 8 months ago

Self Checks

Provide a description of the help you need

I am trying to access an app via API while hosting v.0.4.9 locally in docker & Ollama.

Any ideas as to what I am doing wrong? Here is my request:

POST /v1/chat-messages HTTP/1.1
Authorization: Bearer my-app-api-key
Content-Length: 172
Content-Type: application/json
Host: 192.168.68.50
User-Agent: HTTPie

{
    "inputs": {
      "school": "test"
    },
    "query": "How do I test properly?",
    "response_mode": "blocking",
  "conversation_id": ""
}
dosubot[bot] commented 8 months ago

🤖

Hey there, @StreamlinedStartup! Good to see you again. How are things?

The 405 Not Allowed error typically occurs when the HTTP method used is not supported by the server. In the context of your Docker setup, this could be due to a misconfiguration in the Nginx reverse proxy settings.

The Nginx configuration files are not provided in the context, but they are referenced in the docker-compose.yaml file:

nginx:
  image: nginx:latest
  restart: always
  volumes:
    - ./nginx/nginx.conf:/etc/nginx/nginx.conf
    - ./nginx/proxy.conf:/etc/nginx/proxy.conf
    - ./nginx/conf.d:/etc/nginx/conf.d
  depends_on:
    - api
    - web
  ports:
    - "80:80"

The Nginx service is using configuration files from the ./nginx directory on your host machine. The nginx.conf, proxy.conf, and the files in conf.d directory are mounted into the Nginx container. These files define how Nginx should route incoming requests to the appropriate services.

If you're getting a 405 error, it's possible that the Nginx configuration is not correctly routing your request to the appropriate service, or the method you're using (GET, POST, PUT, DELETE, etc.) is not allowed by the server configuration.

To resolve this issue, you should check the Nginx configuration files (nginx.conf, proxy.conf, and files in conf.d directory) to ensure that they are correctly routing requests to the appropriate services and allowing the HTTP method you're using. If you're not sure how to do this, you may need to consult the Nginx documentation or seek help from someone with experience in Nginx configuration.

Without the Nginx configuration files, I can't provide a more specific solution. You can find more information about the Nginx configuration in the dify codebase in the docker-compose.yaml and proxy.conf files.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

StreamlinedStartup commented 8 months ago

I mistakenly forgot the port in the url. 🥴