How to implement hotlinking prevention in Google App Engine
Asked Answered
E

1

5

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.

Epizoon answered 24/5, 2009 at 5:21 Comment(0)
L
11

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).

Legion answered 24/5, 2009 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.