I configure NGINX proxy cache for Atlassian Confluence

And i faced a problem of caching the edited pages

Some time after editing the pages do not show the changes(cache TTL)

I decided to force the clearing of NGINX cache after pressing the "Save" button

For that i used LUA script:

    location ~ /pages/editpage.action?pageId=87556693 {
            content_by_lua 'os.execute("find /var/cache/nginx/ -type f -delete")';
            return 302 $scheme://example.com$request_uri;

But a got cycle redirections (obviously :)

I have 2 questions:

  1. How to change location ~ /pages/editpage.action?pageId=87556693 for dynamic url (numbers 87556693 can change)?

  2. How to rewrite url /pages/editpage.action?pageId=87556693 to /pages/viewpage.action?pageId=87556693 in location in NGINX? To get rid of cycle redirections

Im not good at regex


  • 1
    The location you show never match anything because query arguments are not part of the location matching. – Alexey Ten Jun 15 '16 at 7:02
  • @AlexeyTen, true -- unless ? was URL-encoded as %3F as per the stackoverflow.com/questions/20470191/… :-) – cnst Jul 3 '16 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.