1

I use this content in my subdomain: https://sub.highping.com.tr/lorem

I want replace all "ipsum" strings when nginx_proxy process.

Can I do it whith ngx_http_sub_module ?

So I tried but couldn't do it.


location  /lorem {

proxy_pass https://raw.githubusercontent.com/subhanahmet/lorem/main/loram.js;

sub_filter_once off;
sub_filter_types text/html;
sub_filter "ipsum" "sometext";
sub_filter_once on;

}

1 Answer 1

2

It might be that your loram.js file is not served as "text/html" Content-Type.

location /lorem {
    proxy_pass https://raw.githubusercontent.com/subhanahmet/lorem/main/loram.js;

    proxy_set_header Accept-Encoding "";
    sub_filter_types text/html;

    sub_filter 'ipsum' 'sometext';
    sub_filter_once off;
}

After updating the configuration, make sure you restart nginx.

sudo systemctl restart nginx
Sign up to request clarification or add additional context in comments.

3 Comments

Yes! Thanks for help. But after changing some things it worked. Like that: proxy_set_header Accept-Encoding ""; sub_filter 'ipsum' 'sometext'; sub_filter_once off; sub_filter_types text/html text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml;
You are most welcome! You can mention on nginx related problems. And I will try to fix them!
Kayes I try Clickup Docs with proxy_pass but it does not working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.