Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need to quote regex in rewrite rules for NGINX_WP_GOOGLE_XML_SITEMAP #94

Closed
Kidun opened this issue Jun 28, 2024 · 1 comment
Closed

Comments

@Kidun
Copy link

Kidun commented Jun 28, 2024

the issue is related to commit fba9729
according to the nginx documentation

if a regular expression includes the “}” or “;” characters, the whole expressions should be enclosed in single or double quotes.

in current state it causes CrashLoopBackOff for nginx pods, when NGINX_WP_GOOGLE_XML_SITEMAP=1 with the following error in log:
nginx: [emerg] directive "rewrite" is not terminated by ";" in /etc/nginx/preset.conf:23

Proposed change: in the file /etc/gotpl/presets/wordpress.conf.tmpl put regex in double quotes:

rewrite "^/.*sitemap.*(?:\d{1,4}(?!-misc)|-misc)?\.xml$" "/index.php?xml_sitemap=params=$2" last;
rewrite "^/.*sitemap.*(?:\d{1,4}(?!-misc)|-misc)?\.xml\.gz$" "/index.php?xml_sitemap=params=$2;zip=true" last;
rewrite "^/.*sitemap.*(?:\d{1,4}(?!-misc)|-misc)?\.html$" "/index.php?xml_sitemap=params=$2;html=true" last;
rewrite "^/.*sitemap.*(?:\d{1,4}(?!-misc)|-misc)?\.html.gz$" "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;

temporary workaround until it's fixed:
build a docker image with modified /etc/gotpl/presets/wordpress.conf.tmpl file

@csandanov
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants