簡體   English   中英

為什么我在heroku上托管的瘦ruby網站上獲得400 Bad Request標頭

[英]Why do I get 400 Bad Request header on a thin ruby website hosted on heroku

我照顧www.lesscss.org。 來源是https://github.com/cloudhead/lesscss.org

這是一個瘦Web應用程序,可以在heroku上運行。 在瀏覽器中訪問網站很好。

我們有一個卷曲的錯誤-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好嗎?

[編輯]

用詳細的選項

$ 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

您正在使用的toto引擎中包含以下行

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

所以任何不是get的東西都會產生400.Toto可能會允許頭部請求通過(如果需要,可以與Rack :: Head結合使用,以便在地板上刪除請求主體)

使用-I您正在進行HEAD請求而不是GET 刪除-I標志,它將工作。 您可以使用-v標志查看它的工作原理:

curl -Iv lesscss.org

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM