0

我负责 www.lesscss.org。来源在这里https://github.com/cloudhead/lesscss.org

这是一个瘦 Web 应用程序,在 heroku 上运行。在浏览器中访问该网站很好。

我们有一个错误, curl -I lesscss.org 给出了 400 请求 - https://github.com/cloudhead/less.js/issues/1232

它确实

$ curl -I lesscss.org
HTTP/1.1 400 Bad Request
Server: nginx
Date: Tue, 19 Mar 2013 01:15:50 GMT
Connection: close

我做了很多搜索,但没有找到原因或如何纠正上述问题.. 不应该是 302 重定向还是 200 ok?

[编辑]

带有详细选项

$ curl -Iv http://www.lesscss.org
* About to connect() to www.lesscss.org port 80 (#0)
*   Trying 107.21.106.77...
* 0x8001f140 is at send pipe head!
* STATE: CONNECT => WAITCONNECT handle 0x80057408; line 1032 (connection #0)
* Connected to www.lesscss.org (107.21.106.77) port 80 (#0)
* STATE: WAITCONNECT => DO handle 0x80057408; line 1151 (connection #0)
> HEAD / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.lesscss.org
> Accept: */*
>
* STATE: DO => DO_DONE handle 0x80057408; line 1236 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x80057408; line 1352 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x80057408; line 1363 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
< Server: nginx
Server: nginx
< Date: Wed, 20 Mar 2013 09:34:37 GMT
Date: Wed, 20 Mar 2013 09:34:37 GMT
< Connection: keep-alive
Connection: keep-alive

<
* STATE: PERFORM => DONE handle 0x80057408; line 1533 (connection #0)
* Connection #0 to host www.lesscss.org left intact
* Expire cleared
4

2 回答 2

2

您正在使用的 toto 引擎中有这一行

return [400, {}, []] unless @request.get?

所以任何不是 get 的东西都会导致 400。Toto 可能会允许 head 请求通过(如果需要,可以结合 Rack::Head 将请求主体放在地板上)

于 2013-03-20T09:44:25.207 回答
0

-I您提出HEAD请求而不是GET. 删除-I标志,它将起作用。您可以看到它如何与-v标志一起使用:

curl -Iv lesscss.org
于 2013-03-20T09:29:27.500 回答