Update docstrings to incidate that forwarded header is used first.
This commit is contained in:
parent
1838f43eff
commit
1dd854f80b
@ -365,7 +365,7 @@ class Request(dict):
|
|||||||
def server_name(self):
|
def server_name(self):
|
||||||
"""
|
"""
|
||||||
Attempt to get the server's hostname in this order:
|
Attempt to get the server's hostname in this order:
|
||||||
`config.SERVER_NAME`, `x-forwarded-host` header, :func:`Request.host`
|
`config.SERVER_NAME`, `forwarded` header, `x-forwarded-host` header, :func:`Request.host`
|
||||||
|
|
||||||
:return: the server name without port number
|
:return: the server name without port number
|
||||||
:rtype: str
|
:rtype: str
|
||||||
@ -406,9 +406,9 @@ class Request(dict):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def remote_addr(self):
|
def remote_addr(self):
|
||||||
"""Attempt to return the original client ip based on X-Forwarded-For
|
"""Attempt to return the original client ip based on `forwarded`,
|
||||||
or X-Real-IP. If HTTP headers are unavailable or untrusted, returns
|
`x-forwarded-for` or `x-real-ip`. If HTTP headers are unavailable or
|
||||||
an empty string.
|
untrusted, returns an empty string.
|
||||||
|
|
||||||
:return: original client ip.
|
:return: original client ip.
|
||||||
"""
|
"""
|
||||||
@ -421,7 +421,8 @@ class Request(dict):
|
|||||||
"""
|
"""
|
||||||
Attempt to get the request scheme.
|
Attempt to get the request scheme.
|
||||||
Seeking the value in this order:
|
Seeking the value in this order:
|
||||||
`x-forwarded-proto` header, `x-scheme` header, the sanic app itself.
|
`forwarded` header, `x-forwarded-proto` header,
|
||||||
|
`x-scheme` header, the sanic app itself.
|
||||||
|
|
||||||
:return: http|https|ws|wss or arbitrary value given by the headers.
|
:return: http|https|ws|wss or arbitrary value given by the headers.
|
||||||
:rtype: str
|
:rtype: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user