Possible bug in a Nginx regex

Discussion in 'Installation/Configuration' started by dfumagalli, Mar 26, 2015.

  1. dfumagalli

    dfumagalli Member


    I think I have found a bug in a ISPConfig 3 Nginx regex.
    I have originally installed the "Perfect server" setup for Ubuntu LTS 12.04, now I have LTS 14.04 and the regex is still here after the upgrade.
    I also have another server installed directly with the "Perfect server" setup for Ubuntu LTS 14.04 and it shows the same regex.

    Basically, in
    we have the following:
            # serve static files directly
            location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                   access_log        off;
    which is different in "style" from the subsequent regexes used for phpmyadmin and other. Not only it's different but in my opinion it has an issue: it does not catch ".<extension>" files but every path that ends with "<extension>", that is, it won't actually check for a dot before the extension.

    The correct regex, as also hinted by the phpadmin etc. other regexes, includes an escape "\" before the file extension dot:
    location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$
    Regular ISPConfig won't show any issue because it's admin page has explicit, non rewritten paths and they usually end with ".php" anyway.

    However the potential issue is still here. In fact I found out about the problem when I copy-pasted the regex and used it into a SEO optimized website of mine.

    Everytime I opened a webpage with this URL scheme:
    the website would brutally "reset" / sort of redirect. Onomastico (an holiday name in my mothertongue) would hit the wrongly filtered "ico" suffix. With the suggested change, it won't.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Thank you for reporting this, the \ is indeed missing. I'll change that in ISPConfig.

Share This Page