Portal Home > Knowledgebase > Articles Database > nginx help
nginx help
Posted by xcpd, 04-10-2012, 03:54 PM |
Hello,
We are using a file hosting script that generates direct links which should be downloadable through nginx. Problem is that for .mpg files the download box (pop up) does not show up. The file can only be saved by right clicking on the link and selecting save target as (save as). This only occurs for .mpg files and only when using Google Chrome In IE at least it streams.
I removed every lines from mime.types except:
Anyone knows what am I missing? Thanks!
|
Posted by Unquantifiable, 04-10-2012, 05:28 PM |
Verify that the server is sending the correct headers.
Open up Chrome, then bring up the developer tools using Shift+Ctrl+I.
Then go the the network tab and download the file again. You should see the request, double click it and check the content-type in the Headers tab.
Alternatively you can curl -I the url if you are running Linux.
|
Posted by xcpd, 04-10-2012, 06:30 PM |
Hi,
Okay, I did what you advised and for some reason the status in network (developer tools) comes up as cancelled when I click the direct link.
Method is Post, Status is cancelled, Type is application/octet-stream, Initiator - Other.
Please advise.
|
Posted by Unquantifiable, 04-11-2012, 05:54 AM |
Why is it Post? I'm confused. If it is only a link that you click then it should be method Get.
|
Posted by xcpd, 04-11-2012, 11:12 AM |
WOW, I must have been really tired when I posted the previous message. My apologies. Indeed, it was a GET. I asked someone to try and download this file and this guy was using an older version of Google Chrome 12.something and he was able to directly download this file by normally clicking the link.
Could this be a Google Chrome security setting, because this server running nginx is on a different (not 80) port which is 83.
Thanks.
|
Posted by funkywizard, 04-11-2012, 01:44 PM |
Headers, headers, headers. I had a similar problem before, and doing some googling, php's documentation has a solution ( http://php.net/manual/en/function.header.php )
Specifically:
Obviously in your situation it would be slightly different since you're doing it from nginx instead of php, but the correct header to be sent to the user would be the same ( Content-Disposition: attachment; filename="" )
|
Posted by xcpd, 04-11-2012, 01:58 PM |
Thank you funkywizard!
I added this code to location and it works perfectly.
Thanks everyone!
|
Posted by funkywizard, 04-11-2012, 03:01 PM |
Great, glad to hear it : )
|
Add to Favourites Print this Article
Also Read