Welcome! Log In Create A New Profile

Advanced

Re: how to setup as caching reverse proxy for/rewritign global URLs

All files from this thread

File Name File Size   Posted by Date  
smime.p7s 5.2 KB open | download Thomas Hartmann 02/20/2019 Read message
smime.p7s 5.2 KB open | download Thomas Hartmann 03/04/2019 Read message
Francis Daly
March 03, 2019 05:56PM
On Wed, Feb 20, 2019 at 12:37:23PM +0100, Thomas Hartmann wrote:

Hi there,

> I would like to setup Nginx as a caching reverse proxy but with explicit
> requests in the URL and rewriting all subsequent requests

"caching reverse proxy" is what nginx is built for.

"rewriting the body content" is not.

> Don;t know, if it really counts as reverse proxy and if it is
> understandable, so an example ;)

The first part of what you want is probably reasonable; the second part
is probably going to involve you writing your own code.

> 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

Your original "https" has become "http" in the middle here. That may or
may not be intentional.

> 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.

You want to take the $request_uri you were given, remove the leading
"/cache/", make sure the rest looks like a url, and proxy_pass to that.

And then take any string in the response body that the browser might
interpret as a url, and make sure that you rewrite it as necessary so
that it expands to the url you need it to be.

Rather than start from scratch, you might have more luck seeing if you
can find the code that Internet Archive's memento proxy uses.

I suspect that it is not "merely" clever nginx config; but it may give
you an idea of the kind of things you will need to do in your version.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

how to setup as caching reverse proxy for/rewritign global URLs Attachments

Thomas Hartmann February 20, 2019 06:38AM

Re: how to setup as caching reverse proxy for/rewritign global URLs

Francis Daly March 03, 2019 05:56PM

RE: how to setup as caching reverse proxy for/rewritign global URLs

Reinis Rozitis March 04, 2019 06:58AM

Re: how to setup as caching reverse proxy for/rewritign global URLs Attachments

Thomas Hartmann March 04, 2019 09:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready