# Set incorrect value for CSRF\_TRUSTED\_ORIGINS

**URL:** <https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [May 10, 2024, 4:15pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732 "2024-05-10T16:15:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdp11d](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jdp11d](https://forum.ansible.com/u/jdp11d)\
**Post date:** [May 10, 2024, 4:15pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/1 "2024-05-10T16:15:54Z")

</div>

I accidentally set in the gui under settings \> miscellaneous system \> CSRF Trusted Origins List a wild card ‘\*’ now my controller goes in a error loop with the error below.

I know I can fix this with the following code to overwrite whats I did.

```auto
  extra_settings:
    - setting: CSRF_TRUSTED_ORIGINS
      value:
        - https://dnsawx.com

```

However If I ever remove this part it will go back to the old CSRF that i set and go into a crash loop again. Does anyone know where this is stored? is it in the db ? can I change this easily without having to use the value on my yaml?

AWX version: AWX 22.5.0

- Include relevant logs from the issue

```auto
System check identified some issues:\\n\\nERRORS:\\n?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found *. See the release notes for details.\\n\", \"stderr_lines\": [\"SystemCheckError: System check identified some issues:\", \"\", \"ERRORS:\", \"?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found *. See the release notes for details

```

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [May 11, 2024, 2:54pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/2 "2024-05-11T14:54:14Z")

</div>

Hi, AFAIK all settings that changed through GUI are stored on the DB.

```bash
$ kubectl -n awx exec -it awx-postgres-13-0 -- psql -U awx -c "select * from conf_setting where key = 'CSRF_TRUSTED_ORIGINS';"
 id | created | modified | key | value | user_id 
----+-------------------------------+-------------------------------+----------------------+-------+---------
  9 | 2024-05-11 14:30:59.853558+00 | 2024-05-11 14:30:59.853566+00 | CSRF_TRUSTED_ORIGINS | ["*"] |        
(1 row)

```

I don’t know if there is a better way, but I believe it is possible to update it directly in SQL. **Please make sure you back the DB up before you try this.**

```bash
$ kubectl -n awx exec -it awx-postgres-13-0 -- psql -U awx -c "update conf_setting set value = '[]' where key = 'CSRF_TRUSTED_ORIGINS';"
UPDATE 1

$ kubectl -n awx exec -it awx-postgres-13-0 -- psql -U awx -c "select * from conf_setting where key = 'CSRF_TRUSTED_ORIGINS';"
 id | created | modified | key | value | user_id 
----+-------------------------------+-------------------------------+----------------------+-------+---------
  9 | 2024-05-11 14:30:59.853558+00 | 2024-05-11 14:30:59.853566+00 | CSRF_TRUSTED_ORIGINS | [] |        
(1 row)

```

> [@jdp11d](#):
>
> AWX version: AWX 22.5.0

BTW, some validations are improved in newer AWX so that `CSRF Trusted Origins` can’t be updated with any values that don’t contain a schema. Please consider upgrading 😃

---

<div class="post-metadata">

**Author:** ![TheRealHaoLiu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/therealhaoliu/32/100_2.png) [@TheRealHaoLiu](https://forum.ansible.com/u/TheRealHaoLiu)\
**Post date:** [May 14, 2024, 10:11pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/3 "2024-05-14T22:11:52Z")

</div>

Something I learn recently. If u want to bring up a debug pod and be able to do ‘awx-manage shell\_plus’ u can use [kubectl debug | Kubernetes](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/)

So ‘kubectl debug awx-task -c awx-task’ will start up duplicate debug pod

U can even run it as root and install debugger and whatnot than start awx with launch\_awx\_\<task/web\> and u will have a functional awx with proper debuggers 😉

---

<div class="post-metadata">

**Author:** ![jdp11d](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jdp11d](https://forum.ansible.com/u/jdp11d)\
**Post date:** [May 17, 2024, 6:16pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/4 "2024-05-17T18:16:03Z")

</div>

I will give that a try ty!

We will upgrade hopefully after fixing this. My fear is that the upgrade will break due to this and leave our deployment in a bad state.

---

<div class="post-metadata">

**Author:** ![jdp11d](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jdp11d](https://forum.ansible.com/u/jdp11d)\
**Post date:** [May 23, 2024, 7:33pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/5 "2024-05-23T19:33:13Z")

</div>

That did it ! Thank you so much!

We are upgrading this weekend 🤞

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 22, 2024, 7:34pm UTC](https://forum.ansible.com/t/set-incorrect-value-for-csrf-trusted-origins/5732/6 "2024-06-22T19:34:04Z")

</div>

Closed on June 22, 2024, 7:34pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
