0

Hello I need to block a specific URL form engintron (nginx)

app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=53e5232
app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=53dad24
app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=9dsdm44
app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=5j33231
app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=51fsd32
app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523&trans_id=9823d22

I need to block the url of specific affiliate with affiliate_id=683. All the traffic coming from this affiliate will go to status code 404

0
Use the below command if you want to block the particular url
iptables -A INPUT -d "app.worldindia.com" -p tcp -j DROP
3
  • I dont want to block "app.worldindia.com" link. I want it to be a specfic link "app.worldindia.com/pubclick/click?affiate_id=683&appoffer_id=4523" – Rishabh Bahukhandi Nov 14 '17 at 6:32
  • for i in url1 url2 url3 …..; do iptables -A INPUT -d “$i” -p tcp -j DROP; done – Praveen Kumar BS Nov 14 '17 at 7:04
  • above command will work for you mention the url in for loop as i mentioned – Praveen Kumar BS Nov 14 '17 at 7:05
0

Use nginx's $arg_ variable1

nginx.conf

⋮

location = /pubclick/click {
    if ( $arg_affiate_id = "683" ) {
        return 404;
    }
    # {OTHER CODE HERE IF NOT 683}
}

⋮
1
  • P.S. There doesn't appear to be else in nginx.conf syntax—it isn't necessary in this case as we're returning and the rest of location block won't be evaluated anyways. – Andrew Siplas Nov 14 '17 at 6:56
0

Really easy to do this in Engintron's custom rules:

if ($SITE ~* (app.worldindia.com/pubclick/click?affiate_id=683) {
    return 403;
}

This will match all the URLs with that affiliate ID. By the way it's better to use a 403 to deny access.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.