You can check
os.environ['REMOTE_ADDR'][:2] == '0.'

All the internal requests (cron, task queue, xmpp, etc.) IPs start with
'0.'.



On Fri, May 20, 2011 at 1:23 PM, 筱枫 <[email protected]> wrote:

> def redirect(app):
>
>        Status = 'Status: 301 Moved Permanently'
>        HOST = 'www.aregg.com'
>
>        if os.environ.get('HTTP_HOST').endswith(HOST) and
> os.environ.get('HTTPS') == 'off' and os.environ.get('X-AppEngine-
> Cron') is None:
>                 sys.stdout.write(Status + '\nLocation: http://' + HOST +
> os.environ['PATH_INFO'])
>                if os.environ.get('QUERY_STRING'):
>                        sys.stdout.write('?' + os.environ['QUERY_STRING'])
>                sys.stdout.write('\n\n')
>
>        else:
>                run_wsgi_app(app)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to