Panel redirects to raw json when clicking dialogues


For some reason, in the panel on my live site, any time I click on a dropdown or click the submit/confirm button inside a pop-up dialogue, I am redirected straight to a page containing the raw JSON contents for what seems to be the menu options or the field content with stuff like:
etc. etc.

It’s a bit frustrating because I can’t recreate the problem in my development files… Removing custom CSS from the panel seemed to fix it for a little bit, but then the problem returned?

Do you see any errors in the console?

I looked into whether cloudflare was affecting this:

I turned off cloudflare proxying and it fixed it.

it must have something to do with the cloudflare settings, i will turn off caching, minification, and other cloudflare settings for the panel and see if that works.

I have confirmed that turning off cloudflare proxy by using cloudflare for DNS only solves this issue – Does anyone know if it is possible to use cloudflare’s proxy with a kirby site?

Could it be that cloud flare strips certain custom request/response headers that tell Kirby how to treat the response? I’m not familiar with cloud fare, but maybe there is an obvious setting around that?

I’m a little bit of a noob when it comes to http headers, but these are the headers from the page i’m redirected to after trying to open a page dropdown:

I’m sure that cloudflare has added in some headers for their own uses, but are there any things missing or weird here?

an update: i think it is affecting the page routing which in turn is why i’m redirected to a page with a url like /panel/dropdowns//pages/page+name

i’m noticing in the network tab of the developer tools:
for a cloudflare proxied site, when switching tabs the page reloads everything. The site temporarily shows a url with /?tab=Pages then removes the / the network inspector shows a complete reload of the page

for a non proxied site, it acts as expected, the url shows ?tab=Pages with no / and the network inspector doesn’t show a reload, it just appends an index.js (fetch) initiator to the list…

What’s your config setup?

nothing special, the default set up plus imagemagick thumbs and some srcsets, routes for front end… i believe thats it