NGINX Proxy pass replace PNG file

Ian Hobson hobson42 at gmail.com
Fri Jun 24 04:18:32 UTC 2022


Hi,

I would try this with a location block...

location /URL/of/Picture/tobereplaced.png {
     root /var/www/test1;
     try_files where/stored/image1.png;
}

location / {
     continue to proxy pass everything else

Hope this helps

Ian

On 24/06/2022 00:01, Jason Prouty wrote:
> Is it possible to replace an PNG file with a local image
> I want to reverse proxy to site and then change the image returned
> 
> I have tried the sub_filter setting but nothing changes.
> 
> 
> server {
>      server_name test1.example1.com;
> 
> location /{
>      proxy_ssl_server_name on;
>      proxy_pass   https://test1.example2.com;
>      sub_filter '<img 
> src="https://test1.example2.com/assets/images/image1.png' '<img 
> src="https://test1.example1.com/image1.png';
>      sub_filter_once on;
>      }
> 
> I just want to replace the image of  the proxied 
> https://test1.example2.com 
> <https://test1.example2.com>;<https://esim.jcius.com/assets/images/powered-by-dark.png>
> https://test1.example2.com/assets/images/image1.png 
> <https://test1.example2.com/assets/images/image1.png>
> with
> a new image hosted locally on my nginx
> 
> 
> 
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org

-- 
Ian Hobson
Tel (+66) 626 544 695



More information about the nginx mailing list