sosedoff / pgweb

Cross-platform client for PostgreSQL databases
https://sosedoff.github.io/pgweb
MIT License
8.59k stars 724 forks source link

Query - Can not input SQL query over ingress #713

Open coduzo opened 7 months ago

coduzo commented 7 months ago

I have depoyed pgweb in kubernetes. Pgweb work well but there is one issue. When I connect to pgweb container with port-forward to localhost:8081 everything works for me. But when I use a public ingress with a oauth proxy then I can not write SQL queries in Query tab. It is not possible to inset text here. All other features are working as expected. In the pgweb logfile there is no message which helps to find the root cause for this issue.

sosedoff commented 6 months ago

Don't think you're going to find anything in the pgweb logs as those are only related to the API calls made by the UI. However, on the UI side you can see any javascript/asset loading errors. Maybe something in Kube stack prevents all javascripts components (like code editor) from loading correctly which results in broken input. That's just my hunch but i've yet to see an error like this myself.

Happy to help if know how to reproduce this issue reliably

coduzo commented 6 months ago

thank you for your message. The issue may be related to the content security policy for the kube ingress. See console logs.

grafik
sosedoff commented 6 months ago

Can you provide a bit more context on your kube setup? I've deployed Pgweb on k8s several times, with ingresses and cert-manager and didnt hit this issue, so i'm suspecting you may have some additional rules in place?

coduzo commented 6 months ago

In our case, the k8s ingress adds HTTP CSP header: "content-security-policy: default-src 'self'" Think this is root cause for the issue. I finally found a workaround for me: Just install a browser extension which disables CSP header. Maybe you can reproduce this issue now.

sosedoff commented 6 months ago

Good to know, thanks!