How to implement hotlinking prevention in Google A

2019-02-07 07:29发布

My application is on GAE and I'm trying to figure out how to prevent hotlinking of images dynamically served (e.g. /image?id=E23432E) in Python. Please advise.

1条回答
Anthone
2楼-- · 2019-02-07 08:14

In Google webapp framework, you can extract the referer from the Request class:

def get(self):
    referer = self.request.headers.get("Referer")
    # Will be None if no referer given in header.

Note that's referer, not referrer (see this dictionary entry).

查看更多
登录 后发表回答