Skip to content

Commit ad96a92

Browse files
Align Orign and Host header (#14970)
* Align Orign and Host header * Before this change the Host: header was runserver. Seems to be set by nginx upstream flow. * After this change we explicitly set the Host: header * More about CSRF checks ... CSRF checks that Origin == Host. Think about how the browser works. <browser goes to awx.com> "I'm executing javascript that I downloaded from awx.com (ORIGIN) and I'm making an XHR POST request to awx.com (HOST)" Server verifies; Host: header == Origin: header; OK! vs. the malicious case. <hacker injects javascript code into google.com> <browser goes to google.com> "I'm executing javascript that I downloaded from google.com (ORIGIN) and I'm making an XHR POST request to awx.com (HOST)" Server verifies; Host: header != Origin: header; NOT OK! * Update awx/settings/development.py --------- Co-authored-by: Hao Liu <[email protected]>
1 parent ca8085f commit ad96a92

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

awx/settings/development.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
AWX_DISABLE_TASK_MANAGERS = False
7575

7676
# Needed for launching runserver in debug mode
77-
CSRF_TRUSTED_ORIGINS = ["https://localhost:8043"]
7877
# ======================!!!!!!! FOR DEVELOPMENT ONLY !!!!!!!=================================
7978

8079
# Store a snapshot of default settings at this point before loading any

tools/docker-compose/ansible/roles/sources/templates/nginx.locations.conf.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ location @fallback {
4646
# Add trailing / if missing
4747
rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent;
4848
proxy_pass http://runserver;
49+
proxy_set_header Host $http_host;
4950
}

0 commit comments

Comments
 (0)