laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.75k stars 291 forks source link

Swoole + Nginx File Download 504 Timeout #362

Closed gofish543 closed 3 years ago

gofish543 commented 3 years ago

Description:

I have a file that I'm attempting to download from storage...

return response()
        ->download($downloadPath, "{$scenario->name}.pdf")
        ->deleteFileAfterSend();

This download results in a 504 Gateway Timeout in production environments using Forge's default configuration for Laravel Octane + Nginx.

I've attempted to fixes like...

 'swoole' => [
        'options' => [
            'package_max_length' => 100000000, // For file downloads
            'socket_buffer_size' => 100000000, // For file downloads
            'buffer_output_size' => 100000000, // For file downloads
        ],
    ]

and increasing the nginx proxy timeout, buffers, and altered various headers. Nothing works.

The nginx error I get is as follows...

2021/08/09 10:00:52 [error] 21683#21683: *2 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 1.1.1.1, server: demo.com, request: "GET /download HTTP/2.0", upstream: "http://127.0.0.1:8000/download", host: "demo.com", referrer: "demo.com"
driesvints commented 3 years ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.