Welcome! Log In Create A New Profile

Advanced

Re: Nginx's sub_filter does not replace paths in CSS and JS

Francis Daly
February 06, 2020 02:56PM
On Wed, Feb 05, 2020 at 07:04:09AM -0500, !QVAS! wrote:

Hi there,

> location /new {
> proxy_pass http://172.22.3.15/;
> }

> server {
> listen 80;
> server_name 172.22.3.15;
>
> location / {
> proxy_pass http://172.22.3.16:8000;
> proxy_redirect / /new;
> sub_filter '"/' '"/new/';
> sub_filter "'/" "'/new/";
> sub_filter_types *;
> sub_filter_once off;
> sub_filter_last_modified on;
> proxy_set_header Accept-Encoding "";
> }
> }
> But the problem is that in the CSS and JS files themselves, the paths are
> not changed.

When I use your config, it seems to work for me.

Can you show one request and the matching incorrect response?

Small is good; something like

curl -v http://examplesite.com/new/a.js

should work -- the matching file a.js in the 172.22.3.16:8000 document
root should have suitable content.

curl -v http://172.22.3.15/a.js
curl -v http://172.22.3.16:8000/a.js

might also be useful, to compare.

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

Nginx's sub_filter does not replace paths in CSS and JS

!QVAS! February 05, 2020 07:04AM

Re: Nginx's sub_filter does not replace paths in CSS and JS

Francis Daly February 06, 2020 02:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 227
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