Skip to content

fix(dify): add GET method support to /dify/retrieval for health check#13837

Open
Lntanohuang wants to merge 1 commit intoinfiniflow:mainfrom
Lntanohuang:fix/dify-retrieval-405-method
Open

fix(dify): add GET method support to /dify/retrieval for health check#13837
Lntanohuang wants to merge 1 commit intoinfiniflow:mainfrom
Lntanohuang:fix/dify-retrieval-405-method

Conversation

@Lntanohuang
Copy link
Copy Markdown
Contributor

Summary

  • Add GET method handler to /api/v1/dify/retrieval endpoint for Dify external knowledge base connectivity verification
  • GET requests return a simple success response; POST requests retain existing retrieval logic unchanged

Problem

When Dify integrates with RAGFlow as an external knowledge base, it sends periodic GET requests to the retrieval endpoint for health/connectivity checks. The endpoint only accepted POST, causing werkzeug to return 405 Method Not Allowed. After several successful POST retrievals, the failing GET health checks trigger Dify's circuit breaker, causing all subsequent requests to fail.

Traceback from the issue:

werkzeug.exceptions.MethodNotAllowed: 405 Method Not Allowed: The method is not allowed for the requested URL.

Changes

  • api/apps/sdk/dify_retrieval.py: Added a separate GET route handler (retrieval_health_check) that returns get_json_result(data=True)

Test plan

  • Verify GET /api/v1/dify/retrieval returns {"code": 0, "message": "success", "data": true}
  • Verify POST /api/v1/dify/retrieval with valid API key and body still works as before
  • Verify Dify external knowledge base integration no longer returns 405 errors

Closes #13788

🤖 Generated with Claude Code

Dify external knowledge base sends GET requests for connectivity
verification. The endpoint only accepted POST, causing werkzeug to
return 405 Method Not Allowed. Add a GET handler that returns a
simple success response.

Closes infiniflow#13788

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐖api The modified files are located under directory 'api/apps/sdk' 🐞 bug Something isn't working, pull request that fix bug. labels Mar 28, 2026
@yingfeng yingfeng added the ci Continue Integration label Mar 29, 2026
@yingfeng yingfeng marked this pull request as draft March 29, 2026 12:21
@yingfeng yingfeng marked this pull request as ready for review March 29, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐖api The modified files are located under directory 'api/apps/sdk' 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

2 participants