Permission error requesting big files


When I try to make a get request to Kong to pick up a file from the server, kong shows me the following error:

request: "GET /alpha/fileSystem/6d3cfcbb-2f06-4332-bf18-59b686345191/download/e04383d8-bba8-44da-a67f-e514e68d8dbd.pdf HTTP/1.1", upstream: "http://...", host: "...:8000", referrer: "http://..."
2021/02/16 12:56:24 [crit] 19#0: *3516 open() "/usr/local/kong/proxy_temp/1/01/0000000011" failed (13: Permission denied) while reading upstream, client: 192. ..., server: kong, request: "GET /alpha/fileSystem/6d3cfcbb-2f06-4332-bf18-59b686345191/download/e04383d8-bba8-44da-a67f-e514e68d8dbd.pdf HTTP/1.1", upstream: "http://...", referrer:

It only occurs on some particular files and not on others, the only difference I have seen in them is the size.

I have tried several configurations in the kong.conf to allow me to return larger files, but what I don’t understand is that the error is a permissions error and not an oversize error.

Any help would be greatly appreciated,



The error that you are seeing is caused by a problem with local filesystem permissions on your proxy_temp_path native value of nginx (Module ngx_http_proxy_module), that is /usr/local/kong/proxy_temp by default.

On upstream responses higher than the default value for proxy buffers (Module ngx_http_proxy_module), Kong buffers to disk the response to that folder, so you are seeing that errors on big files requests because of that.

You can modify that variables with the Kong injected directives to increase the buffer size, and also you need to check the user under wich is running Kong and the owner/perms of the proxy_temp folder.