fix: Preserve HTTPS X-Forwarded-Proto in Nginx and configure SECURE_PROXY_SSL_HEADER in Django to fix 403 CSRF verification on Django Admin

This commit is contained in:
Richard
2026-07-31 11:43:43 +02:00
parent b7a5158254
commit 896dfda240
39 changed files with 366 additions and 499 deletions
+41 -82
View File
@@ -34,16 +34,9 @@ html[data-theme="light"],
--error-fg: #ba2121;
--message-debug-bg: #efefef;
--message-debug-icon: url(../img/icon-debug.svg);
--message-info-bg: #ccefff;
--message-info-icon: url(../img/icon-info.svg);
--message-success-bg: #dfd;
--message-success-icon: url(../img/icon-yes.svg);
--message-warning-bg: #ffc;
--message-warning-icon: url(../img/icon-alert.svg);
--message-error-bg: #ffefef;
--message-error-icon: url(../img/icon-no.svg);
--darkened-bg: #f8f8f8; /* A bit darker than --body-bg */
--selected-bg: #e4e4e4; /* E.g. selected table cells */
@@ -125,16 +118,6 @@ a:focus {
text-decoration: underline;
}
a:not(
[role="button"],
#header a,
#nav-sidebar a,
#content-main.app-list a,
.object-tools a
) {
text-decoration: underline;
}
a img {
border: none;
}
@@ -243,10 +226,10 @@ details summary {
blockquote {
font-size: 0.6875rem;
color: var(--body-quiet-color);
color: #777;
margin-left: 2px;
padding-left: 10px;
border-left: 5px solid currentColor;
border-left: 5px solid #ddd;
}
code, pre {
@@ -645,44 +628,20 @@ ul.messagelist li {
font-size: 0.8125rem;
padding: 10px 10px 10px 65px;
margin: 0 0 10px 0;
background: var(--message-success-bg) url(../img/icon-yes.svg) 40px 12px no-repeat;
background-size: 16px auto;
color: var(--body-fg);
word-break: break-word;
background-color: var(--message-info-bg);
background-image: var(--message-info-icon);
background-position: 40px 12px;
background-repeat: no-repeat;
background-size: 16px auto;
}
ul.messagelist li.debug {
background-color: var(--message-debug-bg);
background-image: var(--message-debug-icon);
}
ul.messagelist li.info {
background-color: var(--message-info-bg);
background-image: var(--message-info-icon);
}
ul.messagelist li.success {
background-color: var(--message-success-bg);
background-image: var(--message-success-icon);
}
ul.messagelist li.warning {
background-color: var(--message-warning-bg);
background-image: var(--message-warning-icon);
background: var(--message-warning-bg) url(../img/icon-alert.svg) 40px 14px no-repeat;
background-size: 14px auto;
}
ul.messagelist li.error {
background-color: var(--message-error-bg);
background-image: var(--message-error-icon);
}
@media (forced-colors: active) {
ul.messagelist li {
border: 1px solid;
}
background: var(--message-error-bg) url(../img/icon-no.svg) 40px 12px no-repeat;
background-size: 16px auto;
}
.errornote {
@@ -809,19 +768,19 @@ a.deletelink:focus, a.deletelink:hover {
/* OBJECT TOOLS */
.object-tools {
padding: 0;
overflow: hidden;
text-align: right;
margin: 0 0 15px;
font-size: 0.625rem;
font-weight: bold;
padding-left: 0;
float: right;
position: relative;
margin-top: -48px;
}
.object-tools li {
display: inline-block;
height: auto;
}
.object-tools li + li {
margin-left: 15px;
display: block;
float: left;
margin-left: 5px;
height: 1rem;
}
.object-tools a {
@@ -1161,40 +1120,40 @@ a.deletelink:focus, a.deletelink:hover {
line-height: 22px;
margin: 0;
border-top: 1px solid var(--hairline-color);
width: 100%;
box-sizing: border-box;
}
.paginator ul {
margin: 0;
margin-right: 6px;
}
.paginator ul li {
display: inline-block;
line-height: 22px;
padding: 0;
}
.paginator a {
display: inline-block;
.paginator a:link, .paginator a:visited {
padding: 2px 6px;
}
.paginator a:not(.showall) {
background: var(--button-bg);
text-decoration: none;
color: var(--button-fg);
}
.paginator a[aria-current="page"] {
color: var(--body-quiet-color);
background: transparent;
font-weight: bold;
cursor: default;
.paginator a.showall {
border: none;
background: none;
color: var(--link-fg);
}
.paginator a:not([aria-current="page"], .showall):focus,
.paginator a:not([aria-current="page"], .showall):hover {
.paginator a.showall:focus, .paginator a.showall:hover {
background: none;
color: var(--link-hover-color);
}
.paginator .end {
margin-right: 6px;
}
.paginator .this-page {
padding: 2px 6px;
font-weight: bold;
font-size: 0.8125rem;
vertical-align: top;
}
.paginator a:focus, .paginator a:hover {
color: white;
background: var(--link-hover-color);
}
+6 -34
View File
@@ -1,22 +1,14 @@
/* CHANGELISTS */
#changelist .changelist-form-container {
#changelist {
display: flex;
align-items: flex-start;
width: 100%;
justify-content: space-between;
}
#changelist .changelist-form-container > div {
#changelist .changelist-form-container {
flex: 1 1 auto;
}
#changelist .changelist-form-container:not(:has(#changelist-filter)) > div {
width: 100%;
}
#changelist .changelist-form-container:has(#changelist-filter) > div {
min-width: 0;
max-width: calc(100% - 270px);
}
#changelist table {
@@ -33,8 +25,8 @@
min-height: 400px;
}
.change-list .filtered .results, .filtered #toolbar,
.filtered div.xfull {
.change-list .filtered .results, .change-list .filtered .paginator,
.filtered #toolbar, .filtered div.xfull {
width: auto;
}
@@ -51,31 +43,11 @@
border-bottom: 1px solid var(--hairline-color);
}
#changelist .changelist-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
border-top: 1px solid var(--hairline-color);
border-bottom: 1px solid var(--hairline-color);
}
#changelist .changelist-footer .paginator {
color: var(--body-quiet-color);
background: var(--body-bg);
border: none;
padding: 0;
}
#changelist .paginator {
color: var(--body-quiet-color);
border-bottom: 1px solid var(--hairline-color);
background: var(--body-bg);
}
#changelist .paginator ul {
padding: 0;
white-space: nowrap;
overflow: hidden;
}
/* CHANGELIST TABLES */
@@ -20,17 +20,9 @@
--border-color: #353535;
--error-fg: #e35f5f;
--message-debug-bg: #4e4e4e;
--message-debug-icon: url(../img/icon-debug-dark.svg);
--message-info-bg: #265895;
--message-info-icon: url(../img/icon-info-dark.svg);
--message-success-bg: #006b1b;
--message-success-icon: url(../img/icon-yes-dark.svg);
--message-warning-bg: #583305;
--message-warning-icon: url(../img/icon-alert-dark.svg);
--message-error-bg: #570808;
--message-error-icon: url(../img/icon-no-dark.svg);
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
@@ -65,17 +57,9 @@ html[data-theme="dark"] {
--border-color: #353535;
--error-fg: #e35f5f;
--message-debug-bg: #4e4e4e;
--message-debug-icon: url(../img/icon-debug-dark.svg);
--message-info-bg: #265895;
--message-info-icon: url(../img/icon-info-dark.svg);
--message-success-bg: #006b1b;
--message-success-icon: url(../img/icon-yes-dark.svg);
--message-warning-bg: #583305;
--message-warning-icon: url(../img/icon-alert-dark.svg);
--message-error-bg: #570808;
--message-error-icon: url(../img/icon-no-dark.svg);
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
+10 -32
View File
@@ -30,20 +30,18 @@ form .form-row p {
flex-wrap: wrap;
}
.form-multiline > div,
.form-multiline > fieldset {
.form-multiline > div {
padding-bottom: 10px;
}
/* FORM LABELS */
legend, label {
label {
font-weight: normal;
color: var(--body-quiet-color);
font-size: 0.8125rem;
}
.required legend, legend.required,
.required label, label.required {
font-weight: bold;
}
@@ -93,20 +91,6 @@ fieldset .inline-heading,
/* ALIGNED FIELDSETS */
.aligned fieldset {
flex-grow: 1;
border-top: none;
}
.aligned fieldset > div {
width: 100%;
}
.aligned legend {
float: inline-start;
}
.aligned legend,
.aligned label {
display: block;
padding: 4px 10px 0 0;
@@ -149,7 +133,7 @@ form .aligned ul {
}
form .aligned div.radiolist {
display: block;
display: inline-block;
margin: 0;
padding: 0;
}
@@ -217,8 +201,7 @@ fieldset .fieldBox {
/* WIDE FIELDSETS */
.wide label,
.wide legend {
.wide label {
width: 200px;
}
@@ -355,7 +338,7 @@ body.popup .submit-row {
width: 48em;
}
.app-flatpages.model-flatpage #id_content {
.flatpages-flatpage #id_content {
height: 40.2em;
}
@@ -430,12 +413,9 @@ body.popup .submit-row {
border: none;
}
.inline-related.tabular div.wrapper {
overflow-x: auto;
}
.inline-related.tabular fieldset.module table {
width: 100%;
overflow-x: scroll;
}
.last-related fieldset {
@@ -449,6 +429,7 @@ body.popup .submit-row {
.inline-group .tabular tr td.original {
padding: 2px 0 0 0;
width: 0;
_position: relative;
}
.inline-group .tabular th.original {
@@ -456,19 +437,16 @@ body.popup .submit-row {
padding: 0;
}
.inline-group .tabular td {
font-size: 1rem;
}
.inline-group .tabular td.original p {
position: absolute;
left: 0;
height: 1.2em;
height: 1.1em;
padding: 2px 9px;
overflow: hidden;
font-size: 0.875rem;
font-size: 0.5625rem;
font-weight: bold;
color: var(--body-quiet-color);
_width: 700px;
}
.inline-group div.add-row,
+37 -18
View File
@@ -170,7 +170,6 @@ input[type="submit"], button {
/* Forms */
legend,
label {
font-size: 1rem;
}
@@ -338,8 +337,16 @@ input[type="submit"], button {
/* Messages */
ul.messagelist li {
padding: 10px 10px 10px 55px;
background-position-x: 30px;
padding-left: 55px;
background-position: 30px 12px;
}
ul.messagelist li.error {
background-position: 30px 12px;
}
ul.messagelist li.warning {
background-position: 30px 14px;
}
/* Login */
@@ -410,15 +417,11 @@ input[type="submit"], button {
/* Changelist */
#changelist .changelist-form-container {
#changelist {
align-items: stretch;
flex-direction: column;
}
#changelist .changelist-form-container:has(#changelist-filter) > div {
max-width: 100%;
width: 100%;
}
#toolbar {
padding: 10px;
}
@@ -441,12 +444,25 @@ input[type="submit"], button {
}
#changelist-filter {
width: 100%;
position: static;
width: auto;
margin-top: 30px;
}
.object-tools {
text-align: left;
float: none;
margin: 0 0 15px;
padding: 0;
overflow: hidden;
}
.object-tools li {
height: auto;
margin-left: 0;
}
.object-tools li + li {
margin-left: 15px;
}
/* Forms */
@@ -485,7 +501,6 @@ input[type="submit"], button {
padding-top: 15px;
}
.aligned legend,
.aligned label {
width: 100%;
min-width: auto;
@@ -560,10 +575,6 @@ input[type="submit"], button {
margin-top: 5px;
}
form .aligned fieldset div.flex-container {
display: unset;
}
/* Related widget */
.related-widget-wrapper {
@@ -728,8 +739,16 @@ input[type="submit"], button {
/* Messages */
ul.messagelist li {
padding: 10px 10px 10px 40px;
background-position-x: 15px;
padding-left: 40px;
background-position: 15px 12px;
}
ul.messagelist li.error {
background-position: 15px 12px;
}
ul.messagelist li.warning {
background-position: 15px 14px;
}
/* Paginator */
@@ -34,15 +34,19 @@
background-position: calc(100% - 8px) 9px;
}
[dir="rtl"] .object-tools li {
float: right;
}
[dir="rtl"] .object-tools li + li {
margin-left: 0;
margin-right: 15px;
}
[dir="rtl"] .dashboard .module table td a {
padding-left: 0;
padding-right: 16px;
}
[dir="rtl"] ul.messagelist li {
padding: 10px 55px 10px 10px;
background-position-x: calc(100% - 30px);
}
}
/* MOBILE */
@@ -63,11 +67,6 @@
margin-left: 0;
margin-right: 0;
}
[dir="rtl"] .object-tools {
text-align: right;
}
[dir="rtl"] .aligned .vCheckboxLabel {
padding: 1px 5px 0 0;
}
@@ -87,9 +86,4 @@
[dir="rtl"] :enabled.selector-add:focus, :enabled.selector-add:hover {
background-position: 0 -72px;
}
[dir="rtl"] ul.messagelist li {
padding: 10px 40px 10px 10px;
background-position-x: calc(100% - 15px);
}
}
+11 -14
View File
@@ -26,12 +26,7 @@ th {
}
.object-tools {
text-align: left;
}
.object-tools li + li {
margin-right: 15px;
margin-left: 0;
float: left;
}
thead th:first-child,
@@ -112,7 +107,7 @@ thead th.sorted .text {
border-left: none;
}
.paginator ul {
.paginator .end {
margin-left: 6px;
margin-right: 0;
}
@@ -124,8 +119,7 @@ thead th.sorted .text {
/* FORMS */
.aligned label,
.aligned legend {
.aligned label {
padding: 0 0 3px 1em;
}
@@ -243,10 +237,18 @@ fieldset .fieldBox {
background-position: 0 -168px;
}
.selector-chooseall {
background: url(../img/selector-icons.svg) right -128px no-repeat;
}
:enabled.selector-chooseall:focus, :enabled.selector-chooseall:hover {
background-position: 100% -144px;
}
.selector-clearall {
background: url(../img/selector-icons.svg) 0 -160px no-repeat;
}
:enabled.selector-clearall:focus, :enabled.selector-clearall:hover {
background-position: 0 -176px;
}
@@ -289,8 +291,3 @@ form .form-row p.datetime {
.selector .selector-chooser {
margin: 0;
}
ul.messagelist li {
padding: 10px 65px 10px 10px;
background-position-x: calc(100% - 40px);
}
+18 -11
View File
@@ -162,21 +162,21 @@
.selector-chooseall, .selector-clearall {
display: inline-block;
height: 16px;
text-align: left;
padding: 4px 5px;
margin: 0 auto;
overflow: hidden;
color: var(--button-fg);
background-color: var(--button-bg);
font-weight: bold;
line-height: 16px;
color: var(--body-quiet-color);
text-decoration: none;
opacity: 0.55;
border: none;
border-radius: 4px;
}
:enabled.selector-chooseall:focus, :enabled.selector-clearall:focus,
:enabled.selector-chooseall:hover, :enabled.selector-clearall:hover {
background-color: var(--button-hover-bg);
color: var(--link-fg);
}
:enabled.selector-chooseall, :enabled.selector-clearall {
@@ -187,10 +187,22 @@
cursor: pointer;
}
.selector-chooseall {
padding: 0 18px 0 0;
background: url(../img/selector-icons.svg) right -160px no-repeat;
cursor: default;
}
:enabled.selector-chooseall:focus, :enabled.selector-chooseall:hover {
background-position: 100% -176px;
}
.selector-clearall {
padding: 0 0 0 18px;
background: url(../img/selector-icons.svg) 0 -128px no-repeat;
cursor: default;
}
:enabled.selector-clearall:focus, :enabled.selector-clearall:hover {
background-position: 0 -144px;
}
@@ -301,10 +313,6 @@ p.datetime {
font-weight: bold;
}
p.datetime label {
display: inline;
}
.datetime span {
white-space: nowrap;
font-weight: normal;
@@ -568,8 +576,7 @@ ul.timelist, .timelist li {
.inline-deletelink {
float: right;
text-indent: -9999px;
background: url(../img/inline-delete.svg) center center no-repeat;
background-size: contain;
background: url(../img/inline-delete.svg) 0 0 no-repeat;
width: 1.5rem;
height: 1.5rem;
border: 0px none;