A
A
Alexander2017-02-06 12:02:43
Nginx
Alexander, 2017-02-06 12:02:43

Is it possible to change the proxied file using NGINX itself?

Hello! We have nginx configured as a proxy. The simplest proxy, without redirects and everything else.

location ~* \.(?:m3u8)(.*)$ {
        proxy_pass http://$arg_proxy;
}
location ~* \.(?:ts)(.*)$ {
        proxy_pass http://$arg_proxy;
}

That is, when the playlist server1/playlist.m3u8?proxy=server2 is requested, everything works as it should. The playlist is being proxied. But the playlist also contains links to ts files (for example, "/hls/firs.ts") and these files are not opened through a proxy, since the proxy variable is not passed in the link to the file. It is necessary to give an already changed playlist with links like "/hls/first.ts?proxy=server2" So, is it possible to edit this playlist "on the fly" using nginx itself and add the "proxy" variable to it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2017-02-06
@Ky6uk-Hy6uk

maybe it's nginx.org/en/docs/http/ngx_http_sub_module.html

A
Alexander, 2017-02-07
@Ky6uk-Hy6uk

I will add. maybe someone needs it. There is also the nginx_substitutions_filter module , which does the same thing, but can already search using regular expressions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question