The problem is that if settings.CSRF_COOKIE_DOMAIN is defined it uses
request.META['SERVER_PORT'] to check that the port is the same and fails
behind a proxy.
Using request method get_port() takes is into account and I find that is
more correct that useing the header directly.
Patch is on:
https://github.com/chemary/django/commit/081685242dac206783024e1834d1f178b5b8b9b9
--
Ticket URL: <https://code.djangoproject.com/ticket/26094>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* severity: Normal => Release blocker
* needs_better_patch: => 1
* needs_tests: => 0
* easy: 1 => 0
* needs_docs: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26094#comment:1>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26094#comment:2>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"2d28144c9519f4e4397c70f045c2b1d31437bf69" 2d28144c]:
{{{
#!CommitTicketReference repository=""
revision="2d28144c9519f4e4397c70f045c2b1d31437bf69"
Fixed #26094 -- Fixed CSRF behind a proxy
(settings.USE_X_FORWARDED_PORT=True).
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26094#comment:3>
Comment (by Tim Graham <timograham@…>):
In [changeset:"076d4591108764695582ab272fdb7f348b4c161c" 076d459]:
{{{
#!CommitTicketReference repository=""
revision="076d4591108764695582ab272fdb7f348b4c161c"
[1.9.x] Fixed #26094 -- Fixed CSRF behind a proxy
(settings.USE_X_FORWARDED_PORT=True).
Backport of 2d28144c9519f4e4397c70f045c2b1d31437bf69 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26094#comment:4>