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?