tianon / squignix

NGINX, configured to act like Squid
MIT License
32 stars 5 forks source link

catch / handle 301 redirects and save the blobs #6

Open MaxPeal opened 4 years ago

MaxPeal commented 4 years ago

can we add a funktion to catch 301 redirects to https and save the blobs? so a http reqest form client will be saved to disk / cache form nginx. and than the client get the file form nginx.

to cache / save files on github, as github hase a forced 301 to https without the need of a MitM CA cert on any clients, as the get the files still only in plan http.

mybe something in this way: location /images/ { root /data/www; error_page 404 = @fetch; }

location @fetch { internal;

proxy_pass         http://backend;
proxy_store        on;
proxy_store_access user:rw group:rw all:r;
proxy_temp_path    /data/temp;

root               /data/www;

} https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_store

mybe some other way? https://github.com/rpardini/docker-registry-proxy/blob/2c8be197be3e74714b53df6b62d2f39029086dc4/nginx.conf#L227

tianon commented 3 years ago

Sorry for the delay! This is a cute hack, but IMO this would encourage folks to use non-https URLs, which I think is a net loss. :confused: :disappointed: