Wrong Content-Type when visiting page through domain but not locally

Here’s my nginx config:

server {
        listen 4444;
        listen [::]:4444;
        server_name localhost;
        root /var/www/html/HRProprietary/HRConvert2;
        index convertCore.php;

        location / {
                try_files $uri $uri/ =404;
                #proxy_pass http://localhost/HRProprietary/HRConvert2/convertCore.php;

        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        }

}

config.yml:

tunnel: id
credentials-file: .cloudflared/id.json

ingress:
  - hostname: xxx.xxx.xxx
    service: http://localhost:4444
  - service: http_status:404

Browser console

Weird thing is that if i click on those link seperately and refresh the page of those links several times, it starts to work in the main page