Weird behavior on ngx_http_sub_module

Fabiano Furtado Pessoa Coelho fusca14 at gmail.com
Mon Dec 2 19:55:44 UTC 2024


Hi NGINX community!

I'm using NGINX version 1.26.2 and trying to modify, for instance, the
original NGINX "403 Forbidden" static HTML page to customize the body
tag.

The original HTML source page is...

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

... and I'm applying, at http{} block, the following directives (in this order):

sub_filter '<center><h1>'
           '<div ...>...</div><center><h1>';
sub_filter '<center><h1>403 Forbidden</h1></center>'
           '<center><h1>403 Access Forbidden!</h1></center>';

The first sub_filter directive worked, but the second did not!
So, I changed the second filter to...

sub_filter '403 Forbidden</h1></center>'
           '403 Access Forbidden!</h1></center>';

... and the substitution worked.

Is this the expected behavior in these situations, where I overlap the
substitution strings (<center><h1>) between sub_filter directives?

Thanks in advance.
Fabiano


More information about the nginx mailing list