我刚刚在同源环境中部署了Django/Python应用程序。应用程序使用Django Rest框架实现REST。
现在,我正在测试同源环境,并且对我想要做的部分更新的资源有一个小问题。但是,localhost中的测试应用程序运行良好。
Localhost: --我使用httpie来使用httpie资源。下面的命令向本地主机中的对象experiment发送一个修补程序:
http -a lab1:'nep-lab1' PATCH http://127.0.0.1:8000/api/experiments/11/ status='to_be_analysed'没关系,补丁做得很成功。
homolog :在同系物环境中相同的命令失败。
http -a lab1:'nep-lab1' PATCH http://myhomologenv.com.br/api/experiments/11/ status='to_be_analysed'错误:
HTTP/1.0 400 Bad Request
Connection: close
Content-Length: 2065
Content-Type: text/html
Date: Thu, 27 Jul 2017 18:48:48 GMT
Server: squid/2.7.STABLE9
Via: 1.0 athena.ime.usp.br:3128 (squid/2.7.STABLE9)
X-Cache: MISS from athena.ime.usp.br
X-Cache-Lookup: NONE from athena.ime.usp.br:3128
X-Squid-Error: ERR_INVALID_REQ 0
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
%l
body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
--></style>
</head><body id="ERR_INVALID_REQ">
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p><b>Invalid Request</b> error was encountered while trying to process the request:</p>
<blockquote id="data">
<pre>PATCH /api/experiments/12 HTTP/1.1
Host: portal-dev.numec.prp.usp.br
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: application/json, */*
User-Agent: HTTPie/0.9.8
Content-Type: application/json
Content-Length: 28
Authorization: Basic bGFiMTpuZXAtbGFiMQ==
{"status": "to_be_analysed"}</pre>
</blockquote>
<p>Some possible problems are:</p>
<ul>
<li id="missing-method"><p>Missing or unknown request method.</p></li>
<li id="missing-url"><p>Missing URL.</p></li>
<li id="missing-protocol"><p>Missing HTTP Identifier (HTTP/1.0).</p></li>
<li><p>Request is too large.</p></li>
<li><p>Content-Length missing for POST or PUT requests.</p></li>
<li><p>Illegal character in hostname; underscores are not allowed.</p></li>
<li><p>HTTP/1.1 <q>Expect:</q> feature is being asked from an HTTP/1.0 software.</p></li>
</ul>
<p>Your cache administrator is <a href="mailto:webmaster">webmaster</a>.</p>
<br>
</div>
<script language="javascript">
if ('[unknown method]' != '[unknown method]') document.getElementById('missing-method').style.display = 'none';
if ('[no URL]' != '[no URL]') document.getElementById('missing-url').style.display = 'none';
if ('[unkown protocol]' != '[unknown protocol]') document.getElementById('missing-protocol').style.display = 'none';
</script>
<hr>
<div id="footer">
<p>Generated Thu, 27 Jul 2017 18:48:48 GMT by athena.ime.usp.br (squid/2.7.STABLE9)</p>
<!-- ERR_INVALID_REQ -->
</div>
</body></html>我正在使用DefaultRouter来创建对象url。
有关使用的工具和包的更多信息:Localhost:
同态:
双双:
发布于 2017-07-28 09:55:28
如响应所述,请与您的系统管理员联系。这个响应是从Squid生成的,所以它甚至没有到达Django项目。
https://stackoverflow.com/questions/45359388
复制相似问题