1

I need to block a hash which is inside a URL through nginx. The URL which requires to be blocked is

http://mp3string.com/video/Kill-My-DeMonZ---Mz-Sunday-Luv-%2B-Jeny-Cox-(-JopRec-)[email protected]%EF%BB%BF/mbqQMZXYL08`

Now if you see the URL the unique hash "mbqQMZXYL08" needs to be blocked through nginx.

I have already tried blocking the URL by adding to the server block, however it is not working.

    RewriteRule ^video/Kill-My-DeMonZ---Mz-Sunday-Luv-%2B-Jeny-Cox-(-JopRec-)[email protected]%EF%BB%BF/mbqQMZXYL08 - [F]

On my website every time any user opens a song it has a Unique hash, since it is a mp3 site and non of the songs are on the website I at times get DMCA to remove the URL.

The redirects I am using in my server block :

    rewrite ^/mp3/([0-9]+)/([^/]*)/([^/]*)(/?)+$ /?do=song&source=$1&title=$2&id=$3 last;
    rewrite ^/video/([^/]*)/([^/]*)(/?)+$ /?do=video&id=$2&title=$1 last;
    rewrite ^/search.html(/?)+$ /?do=search&$args last;
    rewrite ^/embed/([0-9]+)/([^/]*)/([^/]*)(/?)+$ /embed.php?source=$1&title=$2&id=$3&$args last;
    rewrite ^/logout(/?)+$ /?do=logout last;
    rewrite ^/settings(/?)+$ /?do=user last;
    rewrite ^/settings(/?)+$ /?do=user last;
    rewrite ^/playlist/edit/([0-9]+)(/?)+$ /?do=edit_playlist&id=$1 last;
    rewrite ^/playlist/([0-9]+)(/?)+$ /?do=playlist&id=$1 last;
    rewrite ^/playlists(/?)+$ /?do=playlists last;
    rewrite ^/playlists/([0-9]+)(/?)+$ /?do=playlists&p=$1 last;
    rewrite ^/([a-zA-Z0-9_-]+)(/?)$ /?do=profile&username=$1 last;
    rewrite ^/([a-zA-Z0-9_-]+)/favorites(/?)$ /?do=profile&username=$1&action=favorites last;
    rewrite ^/([a-zA-Z0-9_-]+)/playlists(/?)$ /?do=profile&username=$1&action=playlists last;

1 Answer 1

1

Your URI seems to be broken or it contains weird symbols. I am not sure whether it's even HTTP-valid. I'd try to avoid such sick URI formatting.

However, if it is valid, then

location ~* .*mbqQMZXYL08 { return 403; break; }

should do the trick.

2
  • Remove the break instruction, it's useless here. Jan 16, 2015 at 15:11
  • remove your useless comment first. good break is never useless.
    – drookie
    Jan 16, 2015 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .