Hi all,
I would like to setup Nginx as a caching reverse proxy but with explicit
requests in the URL and rewriting all subsequent requests
Don;t know, if it really counts as reverse proxy and if it is
understandable, so an example ;)
For an original URL like
https://org.url.baz/user/repo/foo
I would like to be able to cache all request through nginx running at
my.domain.foo
but with an explicit "cache request" like
wget http://my.domain.foo/cache/http://org.url.baz/user/repo/foo
and rewrite all subsequent request and cache them.
So, I am looking for something similar to Internet Archive's memento proxy
https://web.archive.org/save/https://mailman.nginx.org/pipermail/nginx/2019-February/thread.html
Since my idea is no 'true' reverse proxy, the example [1] needs probably
a bit of extension and I am not sure, how to do the rewrites.
So far my attempts [2] were not really successful - but then I have not
much experiences in that direction and would be grateful, if someone has
an idea for me?
Cheers and thanks,
Thomas
[1]
https://www.nginx.com/resources/wiki/start/topics/examples/reverseproxycachingexample/
[2]
http {
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:10m
inactive=1d max_size=10g;
server {
# server_name *;
location /cache {
rewrite ^(.*)$ /VirtualHostBase/cache$1 break;
proxy_pass http://127.0.0.1:8080;
proxy_cache_revalidate on;
proxy_buffering on;
proxy_cache STATIC;
proxy_ignore_headers Cache-Control;
proxy_cache_valid any 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $host;
}
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx