Latest Publications

Nginx and the upload file size

Today our customer told us about a problem with one of the his website. Sometimes he couldn’t upload a file (PowerPoint presentation). The problem is strange, because in logs we didn’t find an error message.

His website use ruby on rails on the apache (passenger) webserver and nginx for http proxy server. In the beginning I thought it was a problem with rails application, but customer’s programmer checked the code three times and did’t find any problem with an application.

After an hour of searching I looked in nginx logs, where I found this:

2009/09/15 14:59:08 [error] 94387#0: *65836224 client intended to send too large body: 1475115 bytes, client: XXX.XXX.XXX.XXX, server: *.example.com, request: "POST /admin/attachments.js HTTP/1.1", host: "www.example.com", referrer: "http://www.example.com/foo/bar"

The first thought that came to my mind was “Hmm to large filesize”? I went to nginx wiki looking for options that set max upload filesize. I found an option named client_max_body_size. This option sets the max body of upload filesize. Default value is 1 Mb (1M). I changed this options to 5M, so the problem disappeared :)

Komentarze warunkowe w MySQL

MySQL od bardzo wczesnych wersji posiada mechanizm, który powszechnie znany jest jako “komentarze warunkowe”. Przy jego pomocy możemy pisać bardziej eleganckie, przenośne i odporne na błędy zapytania SQL. Komentarze warunkowe są również powszechnie wykorzystywane podczas ataków SQLInjection, a dokładnie w celu sprawdzenia jaka wersja MySQL Serwer zainstalowana jest na serwerze lub też czy w ogóle mamy do czynienia z MySQL Serwerem. 
(more…)