Welcome to Centmin Mod Community
Register Now

Nginx Allow only uploads with specific extension Nginx rewrite rule

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Apr 28, 2019.

  1. pamamolf

    pamamolf Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    3:22 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    Hello

    How can i allow only one specific extension for upload using Nginx rewrite rule?

    Thank you

     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    10:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Wouldn't you do that from the web application layer to control what extensions are uploaded in the web app rather than using nginx to control it.
     
  3. pamamolf

    pamamolf Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    3:22 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    Yes but i was thinking to have an extra layer for security on that :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    10:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Nginx isn't the best way to limit POST requests for this. It should be handled by your web app.