Ticket #6880: 6880_patch.diff
File 6880_patch.diff, 2.7 KB (added by , 16 years ago) |
---|
-
django/http/__init__.py
45 45 def get_host(self): 46 46 """Returns the HTTP host using the environment or request headers.""" 47 47 # We try three options, in order of decreasing preference. 48 if 'HTTP_X_FORWARDED_HOST' in self.META:48 if settings.USE_X_FORWARDED_HOST and 'HTTP_X_FORWARDED_HOST' in self.META: 49 49 host = self.META['HTTP_X_FORWARDED_HOST'] 50 50 elif 'HTTP_HOST' in self.META: 51 51 host = self.META['HTTP_HOST'] -
django/conf/global_settings.py
20 20 # Whether to use the "Etag" header. This saves bandwidth but slows down performance. 21 21 USE_ETAGS = False 22 22 23 # Whether to use the "HTTP_X_FORWARDED_HOST" header as the hostname. Useful for some 24 # virtual hosting situations. 25 USE_X_FORWARDED_HOST = False 26 23 27 # People who get code error notifications. 24 28 # In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com')) 25 29 ADMINS = () -
docs/ref/request-response.txt
184 184 185 185 .. versionadded:: 1.0 186 186 187 Returns the originating host of the request using information from the 188 ``HTTP_X_FORWARDED_HOST`` and ``HTTP_HOST`` headers (in that order). If 189 they don't provide a value, the method uses a combination of 190 ``SERVER_NAME`` and ``SERVER_PORT`` as detailed in `PEP 333`_. 187 Returns the host of the request. If :setting:`USE_X_FORWARDED_HOST` is 188 set to ``True``, the host provided in the ``HTTP_X_FORWARDED_HOST`` 189 header will be used, otherwise the host in the ``HTTP_HOST`` header is 190 used. If neither header provides a value, the method uses a combination 191 of ``SERVER_NAME`` and ``SERVER_PORT`` as detailed in `PEP 333`_. 191 192 192 193 .. _PEP 333: http://www.python.org/dev/peps/pep-0333/ 193 194 -
docs/ref/settings.txt
1203 1203 1204 1204 .. setting:: YEAR_MONTH_FORMAT 1205 1205 1206 USE_X_FORWARDED_HOST 1207 -------------------- 1208 1209 Default: ``False`` 1210 1211 A boolean that specifies whether to use the ``HTTP_X_FORWARDED_HOST`` header as 1212 the hostname when generating absolute URLs from relative URLs. This can be 1213 useful for some virtual hosting configurations. 1214 1206 1215 YEAR_MONTH_FORMAT 1207 1216 ----------------- 1208 1217