Redmine REST API创建工单成功却返回404错误求助
Redmine REST API创建工单成功但返回404 Not Found问题排查
问题现象
通过Redmine REST API创建工单时,系列GET请求均执行成功,但最后一个POST issues.json请求出现异常:工单已在Redmine中创建成功,但接口返回404 Not Found错误。
请求详情
POST https://www.example.com/redmine/issues.json HTTP/1.1 X-Redmine-API-Key: d...2 Accept: application/json, application/xml;q=0.9, text/xml;q=0.8, multipart/*;q=0.7, */*;q=0.6 Content-Type: application/json;charset=UTF-8 User-Agent: OurApp/1.0.0.0 (Windows NT 10.0; Win64; x32) Host: www.example.com Content-Length: 99 Connection: Keep-Alive Cache-Control: no-cache Cookie: _redmine_session=a....b { "issue": { "project_id": 3, "subject": "Test", "description": "Test" } }
响应详情
HTTP/1.1 404 Not Found Date: Wed, 04 Jun 2025 12:07:42 GMT Server: Apache/2.4.58 (Ubuntu) cache-control: no-cache referrer-policy: strict-origin-when-cross-origin x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block x-request-id: c...6 x-download-options: noopen x-runtime: 0.057105 x-frame-options: SAMEORIGIN x-content-type-options: nosniff X-Powered-By: Phusion Passenger(R) 6.0.27 content-length: 0 Status: 404 Not Found Content-Type: application/json Set-Cookie: _redmine_session=e...8; path=/redmine; httponly; samesite=lax Via: 1.1 www.example.com Keep-Alive: timeout=5, max=100 Connection: Keep-Alive
环境信息
- Redmine版本:6.0.4.stable
- Ruby版本:3.3.6-p108 (2024-11-05) [x86_64-linux]
- Rails版本:7.2.2.1
- 数据库适配器:Mysql2
- 邮件队列:ActiveJob::QueueAdapters::AsyncAdapter
- 邮件投递方式:smtp
- Redmine主题:Bleuclair(含JavaScript)
- SCM:Subversion 1.14.3、Git 2.43.0、Filesystem
- Redmine插件:redmine_agile 1.6.10
排查方向
- 服务器代理/路由配置检查:对比测试环境与客户端环境的Apache虚拟主机配置(如
RewriteRule、PassengerBaseURI),确认/issues.json路径的POST请求未被篡改;检查代理服务器的请求转发规则,排除路径解析错误。 - 插件冲突排查:临时禁用
redmine_agile插件后重新测试,验证是否为插件修改了Issue创建后的回调逻辑或路由导致异常。 - 主题JavaScript干扰验证:切换至Redmine默认主题,排除Bleuclair主题的JS代码对API响应的拦截或篡改。
- 日志分析:
- 查看Redmine的
production.log,搜索对应x-request-id: c...6的日志,确认工单创建后的响应流程是否存在模板缺失或路径错误。 - 检查Apache的
access.log和error.log,查看POST请求的处理记录,是否有重定向、路径变更或错误信息。
- 查看Redmine的
- 会话一致性验证:确认客户端环境的会话Cookie路径(响应中为
/redmine)与请求路径匹配,排查会话在请求过程中是否被意外重置,导致Redmine返回时丢失上下文。
内容的提问来源于stack exchange,提问作者Alex
相关产品推荐
相关产品推荐

