Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Proxying a remote munin server

$
0
0
I think I' m getting reaaaally close...

It turned out to be far more complex that I thought...
To succeed I use a combination of rewrites, in a determined sequence, playing with last and break at the end, to control what goes to the remote munin server. this is DONE

The problem comes with the reply from the munin server... I need to modify it
I had to recompile in order to use the subs filter, so it is not an "out of the box" (or at least I did not figure out how to do it anotherway)
Once with subs filter enabled, I can deal with modifying the munin server reply...

Her comes the nex question.... how to replace "../" appearances with nothing?
I need to delete ../ ../../ strings on the reply, but I'm not succeeding...

Here I post what I have done so far.... (maybe also helps somebody :-) )

location /graphs/ {
subs_filter_types text/html text/css text/xml;
subs_filter href=" href="http://somedomain.example.com/graphs/;
subs_filter (../*) ir;

proxy_buffering off;

rewrite /graphs/munin/static/(.*) /munin/static/$1 break;
rewrite /graphs/munin/(.*) /munin/somedomain.example.com/Servers/somedomain/$1 break;
rewrite /graphs/munin-cgi/(.*) /munin-cgi/munin-cgi-graph/somedomain.example.com/Servers/somedomain/$1 break;


rewrite /graphs/(.*).(png|jpg|gif) /graphs/munin-cgi/$1.$2 last;
rewrite /graphs/(.*)/(static)/(.*) /graphs/munin/static/$2 last;
rewrite /graphs/(.*) /graphs/munin/$1 last;


proxy_pass http://my-munin-server.example.com/;

proxy_redirect default;
}

note the line: subs_filter (../*) ir; ... this is where I'm stuck...
I need something like: subs_filter (../*) NULL ir; in order to delete ../ appearances

Best regards to everyone and happy new year!!!

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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