Hotlink Protection with FireWall

I want block all link if it’s not use on my site…so i create firewall, firewall working perfect if i use diff domain…but when i use subdomain, firewall not working anymore

(http.request.method eq “GET” and http.host in {“photo.mydomain.com”} and not http.referer contains “mydomain.com”)

Hi @dnstylish,

That isn’t exactly clear to me, but I will try to help you.


Do you want to restrict access to photos.mydomain.com to only one or a few subdomains of mydomain.com but not the entire zone?


  1. As written, mydomain.com and all its subdomains will be allowed.

  2. If the target is only photos.mydomain.com, you may want to change the http.host operator from in to eq and adjust the semantics.

  3. Since the http.referer field is set with the contains operator and mydomain.com value, any other domains/subdomains containing that value will be accepted. For example:

    • A domain “examplemydomain.com
    • A subdomain “mydomain.com.example.tld

Usually the third situation isn’t a problem, but these scenarios can be avoided if necessary.


Anyway, you can make it more reliable by making some fine tuning.

Example

  • Request Method equals “GET
    (and)
  • Hostname equals “photos.mydomain.com
    (and)
  • Referer does not equal “mydomain.com
    (and)
  • Referer does not contain “.mydomain.com

Action: Block

Expression:

(http.request.method eq "GET" and http.host eq "photos.mydomain.com" and http.referer ne "mydomain.com" and not http.referer contains ".mydomain.com")

I hope it helps. Please let me know if I can help you with any further questions.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.