Nginx return 200 downloads a file






















At this time, the header is actively added in the location block of nginx to output the correct encoding. Your email address will not be published.

First look at how to return fixed text and json, they are configured in the nginx server segment to configure the location item to intercept, the configuration example is as follows: Fixed text:. Leave a Reply Cancel reply Your email address will not be published. This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Close Privacy Overview This website uses cookies to improve your experience while you navigate through the website.

Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent.

Now refresh the page, user will be asked for username and password. If you enter the correct credentials, you will be allowed to access these locations.

Otherwith, you will see " Authorization Required" error page. I know it's not the best way of handling file upload, but NGINX is versatile enough to achieve this without any backend support. Until now, all the features above are provided by nginx itself. This module is so simple that user just needs to call the read method chunk by chunk. I also add a location which enables user to delete a file or an empty folder.

But such sub folders should already exist or error will occur. I prefer cURL to Postman for debugging. Actually I seek help from nginx-upload-module at first. It was an awesome module. However, the owner is no longer maintaining this module. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Return by Nginx without serving a file Ask Question. Asked 3 years, 9 months ago. Active 3 years, 7 months ago. Viewed 16k times. I changed to this but still not working.

Keke Keke 31 1 1 gold badge 1 1 silver badge 4 4 bronze badges. The location block is fine, but you are putting it into the wrong server block.

See how nginx processes a request for more. I found the reason why it wasn't working and it was how you said. KeKe Could you please post what the reason was, it would be helpful.

I am facing the same issue, tried all the things you have posted plus few more but still unable to figure out what the issue is.



0コメント

  • 1000 / 1000