Django Book 翻译
菜单>:
TOC
返回
原文:
This is the example we examined in the Whats Middleware? section earlier. It sets ``request.META['REMOTE_ADDR']`` based on ``request.META['HTTP_X_FORWARDED_FOR']`` , if the latter is set. This is useful if youre sitting behind a reverse proxy that causes each requests ``REMOTE_ADDR`` to be set to ``127.0.0.1`` .
翻译:
这是我们在 什么是中间件 这一节中所举的例子。 在 ``request.META['HTTP_X_FORWARDED_FOR']`` 存在的前提下,它根据其值来设置 ``request.META['REMOTE_ADDR']`` 。在站点位于某个反向代理之后的、每个request的 ``REMOTE_ADDR`` 都被指向 ``127.0.0.1`` 的情形下,这一功能将非常有用。
备注:
译者: