Crafter Delivery 3用Curl重索引Solr遇Content-Type不支持错误求助
解决Crafter Delivery节点Solr重新索引的Content-Type错误
这个错误的根源很明确:你在请求里指定的text/json并非标准的JSON内容类型,Crafter的API只接受**标准的application/json**作为JSON请求的Content-Type。
直接修正你的curl命令即可,把Content-Type头改成正确的值:
curl "http://{hostname}:{port}/api/1/target/deploy/{environment}/{siteName}" -X POST -H "Content-Type: application/json" -d '{ "reprocess_all_files": true }'
另外给你几个额外的注意点,避免后续踩坑:
- 确认你替换的
{hostname}、{port}、{environment}(通常是preview或live)和{siteName}完全匹配你的Crafter配置,别打错字 - 如果你的Delivery节点启用了基础认证,需要在curl命令里加上
-u 用户名:密码参数来传递凭据,比如:curl -u admin:admin "http://{hostname}:{port}/api/1/target/deploy/{environment}/{siteName}" -X POST -H "Content-Type: application/json" -d '{ "reprocess_all_files": true }' - 执行命令前可以先通过简单的GET请求测试节点连通性,比如
curl "http://{hostname}:{port}/api/1/sites",确保API服务正常响应
内容的提问来源于stack exchange,提问作者Y Vala
相关产品推荐
相关产品推荐

