I would like to redirect all our sitemap sections the same way we did for the root one.
location = /sitemap.xml {
proxy_pass https://redacted.fr/sitemap.xml;
}
So I would like to do the same for, let say, sitemap-group1.xml but I can't write it down to NGINX like the root one as it's dynamic.
I think what would help is to have a wildcard and get the path to proxy_pass, but I have no idea how.
EDIT: My only goal is to proxy_pass
/sitemap*.xml to https://redacted.fr/sitemap*.xml
Try the regex matching location block:
location ~ ^/sitemap[^/]*\.xml$ {
proxy_pass https://redacted.fr;
}
If you have any other regex matching locations (locations with ~
modifier), take into account that the first matched location is used for the request processing, so I suggest to put this one before any other of regex matching locations. If you want case-insensitive matching, use ~*
instead of ~
.