Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5956

How to stop 301 redirects from files in one nginx directory?

$
0
0

All the websites running on my Ubuntu VPS are configured through nginx to 301-redirect as follows:

http://www.example.com/ -> https://example.com

Normally this is fine, no problems. But I have 2 .gz files in a certain directory of my website, and those compressed files contain firmware updates for devices in the field that don't support https. So when the devices request the firmware update, they get 301-redirected to https, which breaks/halts the update.

ChatGPT instructed me to add the following section to my website-specific nginx conf file:

location ~ \.gz$ {  root /home/mysitedefault/htdocs/example.com/Firmware;    types {      application/x-gzip gz;  }  add_header Content-Encoding gzip;  try_files $uri =404;}

That path to the right of root is confirmed correct; that is the directory where the firmware .gz files reside. I made the change to the .conf file and saved it. I then restarted nginx.

Results: Nothing changed. The 301-redirect continues to occur.

What am I doing wrong?


Viewing all articles
Browse latest Browse all 5956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>