Closed axeleroy closed 1 year ago
I don't know reverse proxies well enough to decode what you have is interferring - my suggestion is to get your reverse down to minimum config and add back the additional configurations to determine what is breaking.
My instincts are something in one of these lines could be doing something unexpected. Content-length of 75 looks
"referer":"https://recipes.selfhosting.axeleroy.com/data/import/url",
"sec-fetch-dest":"empty",
"sec-fetch-mode":"cors",
"sec-fetch-site":"same-origin",
"sec-gpc":"1",
"cookie":"xxxxxx"
Well, the thing is BunkerWeb does hardening and adds security headers by default, its configuration is already close to its default (which I admit is far from vanilla nginx) :/
Well, the thing is BunkerWeb does hardening and adds security headers by default, its configuration is already close to its default (which I admit is far from vanilla nginx) :/
hard to fix it until you can figure out which part is breaking it....
this looks relevant - does your env include CSRF_TRUSTED_ORIGINS
?
this looks relevant - does your env include CSRF_TRUSTED_ORIGINS ?
It did not include it, but after adding the variable it hasn't changed anything.
I'm having the same issue through haproxy. I can sorta half-solve it by adding CSRF_TRUSTED_ORIGINS="https://my.trusted.domain" to my .env. That gets me through the login screen, but nothing really works once I'm in, and I just get "Failure: There was an error fetching a resource!" errors whenever I click on anything in the web UI.
Hello,
I looked into the issue once again by comparing requests made directly to Tandoor and through the proxy and I've found that the X-CSRF-TOKEN
header is missing.
After a brief search in BunkerWeb's issue tracker, I've found the culprit and a fix: BunkerWeb adds the HttpOnly
flag to cookies, preventing Javascript from accessing them and thus the front-end to build and add the X-CSRF-TOKEN
!
Changing the configuration to remove the HttpOnly
flag fixed the issue.
HttpOnly
Just wanted to thank you for documenting this here.. I was going crazy until I stumbled upon this solution, which worked for me too. I had previously hardened my vanilla apache setup with HttpOnly
, so removing that and logging out & in again worked for me.
Issue
Hello,
I set up Tandoor using the Docker "plain" setup with a reverse proxy in front of it (BunkerWeb) but unfortunately some requests made by the front-end fail with the following error:
CSRF Failed: CSRF token missing.
I then followed the docs and updated my reverse proxy configuration in order to set the
Host
andX-Forwarded-Proto
headers but the issue persisted. I almost went crazy thinking my reverse proxy would not follow my custom configuration or nuke thecsrftoken
cookie but I ended modifying Tandoor's nginx configuration to log the request headers, and lo and behold everything is there :exploding_head:And frustratingly enough, when accessing the front-end directly through Tandoor's nginx the request works as expecte...
So I'm left scratching my head, I don't know what I could have missed or where I should look :/ Thanks in advance for your help!
Tandoor Version
1.5.4
OS Version
TrueNAS SCALE 22.12.0
Setup
Docker / Docker-Compose
Reverse Proxy
Others (please state below)
Other
BunkerWeb 1.4.0 (nginx-based)
Environment file
Docker-Compose file
Relevant logs
No response