moorkop / mccy-engine

Provides a web based "Minecraft Server as a Service" (MCaaS?) to deploy Minecraft server containers on any Docker Swarm cluster or standalone Engine instance.
Apache License 2.0
12 stars 4 forks source link

Uploading mods via nginx proxy is giving 500 error #48

Closed itzg closed 8 years ago

itzg commented 8 years ago

I suspect it's due to the file upload size limit.

From nginx logs

2016/01/20 03:38:08 [crit] 18#0: *2 open() "/var/lib/nginx/tmp/client_body/0000000008" failed (13: Permission denied), client: 70.119.96.234, server: mccy.itzg.me, request: "POST /api/uploads/mods HTTP/1.1", host: "mccy.itzg.me", referrer:
"https://mccy.itzg.me/"
70.119.96.234 - - [20/Jan/2016:03:38:08 +0000] "POST /api/uploads/mods HTTP/1.1" 500 594 "https://mccy.itzg.me/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"

From browser (in HAR format)

{
    "log": {
        "version": "1.2",
        "creator": {
            "name": "WebInspector",
            "version": "537.36"
        },
        "pages": [],
        "entries": [
            {
                "startedDateTime": "2016-01-20T03:38:08.284Z",
                "time": 160.45500000473112,
                "request": {
                    "method": "POST",
                    "url": "https://mccy.itzg.me/api/uploads/mods",
                    "httpVersion": "HTTP/1.1",
                    "headers": [
                        {
                            "name": "Pragma",
                            "value": "no-cache"
                        },
                        {
                            "name": "Origin",
                            "value": "https://mccy.itzg.me"
                        },
                        {
                            "name": "X-XSRF-TOKEN",
                            "value": "50527293-997d-4847-b4b8-62c63cd40ccf"
                        },
                        {
                            "name": "Accept-Encoding",
                            "value": "gzip, deflate"
                        },
                        {
                            "name": "Host",
                            "value": "mccy.itzg.me"
                        },
                        {
                            "name": "Accept-Language",
                            "value": "en-US,en;q=0.8"
                        },
                        {
                            "name": "User-Agent",
                            "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
                        },
                        {
                            "name": "Content-Type",
                            "value": "multipart/form-data; boundary=----WebKitFormBoundarykvV8Wu6Tms4PN66U"
                        },
                        {
                            "name": "Accept",
                            "value": "application/json, text/plain, */*"
                        },
                        {
                            "name": "Cache-Control",
                            "value": "no-cache"
                        },
                        {
                            "name": "Referer",
                            "value": "https://mccy.itzg.me/"
                        },
                        {
                            "name": "Cookie",
                            "value": "JSESSIONID=4D29D1860A2E9457D46C0FF689737FE0; XSRF-TOKEN=50527293-997d-4847-b4b8-62c63cd40ccf"
                        },
                        {
                            "name": "Connection",
                            "value": "keep-alive"
                        },
                        {
                            "name": "Content-Length",
                            "value": "215162"
                        }
                    ],
                    "queryString": [],
                    "cookies": [
                        {
                            "name": "JSESSIONID",
                            "value": "4D29D1860A2E9457D46C0FF689737FE0",
                            "expires": null,
                            "httpOnly": false,
                            "secure": false
                        },
                        {
                            "name": "XSRF-TOKEN",
                            "value": "50527293-997d-4847-b4b8-62c63cd40ccf",
                            "expires": null,
                            "httpOnly": false,
                            "secure": false
                        }
                    ],
                    "headersSize": 683,
                    "bodySize": 220,
                    "postData": {
                        "mimeType": "multipart/form-data; boundary=----WebKitFormBoundarykvV8Wu6Tms4PN66U",
                        "text": "------WebKitFormBoundarykvV8Wu6Tms4PN66U\r\nContent-Disposition: form-data; name=\"files\"; filename=\"chiselsandbits-mc1.8-v1.6.2.jar\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundarykvV8Wu6Tms4PN66U--\r\n"
                    }
                },
                "response": {
                    "status": 500,
                    "statusText": "Internal Server Error",
                    "httpVersion": "HTTP/1.1",
                    "headers": [
                        {
                            "name": "Date",
                            "value": "Wed, 20 Jan 2016 03:38:08 GMT"
                        },
                        {
                            "name": "Server",
                            "value": "nginx/1.8.0"
                        },
                        {
                            "name": "Connection",
                            "value": "close"
                        },
                        {
                            "name": "Content-Length",
                            "value": "594"
                        },
                        {
                            "name": "Content-Type",
                            "value": "text/html"
                        }
                    ],
                    "cookies": [],
                    "content": {
                        "size": 594,
                        "mimeType": "text/html",
                        "compression": 0
                    },
                    "redirectURL": "",
                    "headersSize": 161,
                    "bodySize": 594,
                    "_transferSize": 755
                },
                "cache": {},
                "timings": {
                    "blocked": 2.79599998611957,
                    "dns": -1,
                    "connect": -1,
                    "send": 157.12699998402942,
                    "wait": 0.10900001507300772,
                    "receive": 0.4230000195091179,
                    "ssl": -1
                },
                "connection": "224913"
            }
        ]
    }
}
itzg commented 8 years ago

Some solutions to explore

http://killtheradio.net/technology/nginx-returns-error-on-file-upload/

itzg commented 8 years ago

Note

It's file upload size related (which makes sense) since an 8 KB mod worked fine. A 200 KB did not work.

itzg commented 8 years ago

I'll revisit the proxy image if/when this PR is resolved https://github.com/smashwilson/lets-nginx/pull/7