TrueCharts Traefik CORS problem

wronan

Cadet
Joined
Aug 22, 2023
Messages
6
Hello.
I'm experiencing peculiar problems with CORS on TrueCharts Traefik.
My TrueNAS version is TrueNAS-SCALE-22.12.3.3
Traefik app version is 2.10.4_21.0.0

I've said "peculiar" because it's hard for me to believe that no one stumbled upon the same but I'm searching and searching... and nothing.

The base issue is: response for the OPTION (preflight) request made to the app behind the Traefik does not contain `access-control-allow-origin` header which results in browser error.

There's a `ix-traefik-tc-opencors-headers@kubernetescrd` middleware available so I've added it to my app, but it changed nothing. Furthermore looks like the headers from the middleware are not applied at all. I've locally edited the corresponding yaml file from the release directory, changing the value of `access-control-max-age` value from `100` to `101` which found it's reflection in the Traefik dasboard but the http responses still contain the old `100`.
In the Traefik dashboard I see the `Used by Routers` section populated with actual services but without any other effect.

So... if the built-in middleware is not working made me thinking that maybe the custom ones will which lead me to the second issue: I've discovered is that I can't add own `Custom Request Headers` and `Custom Response Headers`.
This seems like a GUI problem: submitting the app form causes `TypeError: gt.schema.items is undefined` error in the browser console. I'm a backend developer, frontend is not my thing but considering the "old times" when every browser handled JS in it's own way I've checked it on another browser with the same result (first one was FF, the second one was Chrome).

--------------------

I failed to find anything related to those two problems, neither here nor on Github and this is what worries me - hard for me to believe that such basic issues were not noticed by anyone. Before I post an issue on GH I'd be glad if someone could confirm you can also observe the same problems.

Thx in advance.
 
Joined
Aug 24, 2023
Messages
3
I don't have a solution unfortunately, but I just ran into the same issue using Firefox on macOS. I'm also using Traefik to access the GUI.
 
Joined
Aug 24, 2023
Messages
3
On closer inspection, for me the problem specifically appears when I try to add entries to the rules section of the authelia config. If I don't add any rules, I don't get an error and it submits just fine. If I add any rules, nothing happens when I press submit and the `TypeError: gt.schema.items is undefined` error appears in the browser console.
 
Joined
Aug 24, 2023
Messages
3
I found some existing issues related to my specific issue. It's a GUI error.
 

wronan

Cadet
Joined
Aug 22, 2023
Messages
6
My temporary workaround is a browser plugin which adds `Origin` header on it's own. Since this is my internal app it suits my needs for now.
I'm overloaded with work but I plan on posting an issue on Github. If you plan to do it, please post the link here. Thanks.
 

Dhs92

Cadet
Joined
Sep 25, 2023
Messages
5
My temporary workaround is a browser plugin which adds `Origin` header on it's own. Since this is my internal app it suits my needs for now.
I'm overloaded with work but I plan on posting an issue on Github. If you plan to do it, please post the link here. Thanks.
Are you still having issues on 22.12.4? I'm personally getting a new error

1696355662117.png
 

wronan

Cadet
Joined
Aug 22, 2023
Messages
6
I've updated to 22.12.4 and this fixed the GUI error while adding new middlewares.
So I've configured a new one (response-headers), attached it to the service.
In the Traefik control panel I can see it being attached - so this part is OK.
I can see this new configured response header for the GET/POST requests, but still not for the OPTION - the same way as it was with the `tc-opencors-headers` preconfigured middleware.

Traefik must control OPTION on it's own disregarding the configured middlewares.
 

Dhs92

Cadet
Joined
Sep 25, 2023
Messages
5
Oh, so you're also having the issue with OPTION requests. Hm, I'll ask around in the TrueCharts discord to see if anyone knows what's going on.
I've updated to 22.12.4 and this fixed the GUI error while adding new middlewares.
So I've configured a new one (response-headers), attached it to the service.
In the Traefik control panel I can see it being attached - so this part is OK.
I can see this new configured response header for the GET/POST requests, but still not for the OPTION - the same way as it was with the `tc-opencors-headers` preconfigured middleware.

Traefik must control OPTION on it's own disregarding the configured middlewares.
 

garfunkel

Dabbler
Joined
Jun 15, 2012
Messages
41
I'm also having the same issue (Traefik appears to ignore adding response headers on an OPTIONS). Anyone figured out a solution?
 

wronan

Cadet
Joined
Aug 22, 2023
Messages
6
On one hand I'm sorry that you are having the same problem, on the other I'm happy that I'm not the only one :)

I haven't posted the GH issue for TC yet because I wasn't sure that it's not me providing wrong configuration somehow. But with you here I'm starting to believe that indeed there's a bug.
What I'm still not sure is whether it's a Traefik "thing", or it's TC integration.
I've also figured out at funny thing: when I send a OPTIONS request to a non-existing path, I still get code 200 response, so for sure Traefik is hijacking this whole request (otherwise I'd get 404 - I think).
 

garfunkel

Dabbler
Joined
Jun 15, 2012
Messages
41
Does anyone know where middleware you create in the UI is actually set/stored? I'm looking through everything with kubectl and portainer and for the life of me I cannot see where it's actually stored. Like, if I create a rewriteRegex middleware (or custom header etc) named "dash", I cannot find it set in any yaml/config file anywhere... anyone know? I can see that ingresses have the names of middlewares set as annotations, but where they are actually defined is what I'm looking for. I was hoping to try to investigate this issue further but in doing so found that I can't even locate the damn thing...
 

Dhs92

Cadet
Joined
Sep 25, 2023
Messages
5
Does anyone know where middleware you create in the UI is actually set/stored? I'm looking through everything with kubectl and portainer and for the life of me I cannot see where it's actually stored. Like, if I create a rewriteRegex middleware (or custom header etc) named "dash", I cannot find it set in any yaml/config file anywhere... anyone know? I can see that ingresses have the names of middlewares set as annotations, but where they are actually defined is what I'm looking for. I was hoping to try to investigate this issue further but in doing so found that I can't even locate the damn thing...
I haven't been able to get a reply in the TrueCharts Discord, and Traefik appears to work correctly when not installed through TC (you just lose access to the ingress options).
 

garfunkel

Dabbler
Joined
Jun 15, 2012
Messages
41
I am now 100% convinced this is a bug. There is something funky the truecharts folk are doing here...

I think the solution for me is going to be to setup some proxy using nginx or something and run my request (from grafana) through that.

Very annoying.
 

wronan

Cadet
Joined
Aug 22, 2023
Messages
6
I've finally decided to take a deeper dive (I'm on vacation and have some free time :) into this problem. So I upgraded all apps and in the Advanced Settings section of the ingress I found a new checkbox called `Allow Cross Origin Requests`, checked it, saved it while keeping my expectations low but ... this was it :D
It's working!
Whoever fixed it: you the real MVP.

For those who can't find the checkbox, I've prepared an info-graphics dedicated for this occasion:
1702054022865.png


Anyway, all my problems related to this topic are solved, which feels even better considering it was a small surprise.
 
Top