Score:1

strict MIME type checking is enabled issue with PGAdmin in Azure application gateway

kn flag

I am trying to install pgAdmin (image: 'dpage/pgadmin4:6.21') in Azure AKS. I am able to access the application when I use a Kubernetes LoadBalancer service, but when I use an Azure Application Gateway with Ingress, the login page is displayed without an issue. However, after login, it gets stuck on the loading page.

enter image description here

When I checked the browser console, I found the following error:

Refused to execute script from 'https://somedomain.xyz.cloudapp.azure.com/pgadmin4/login?next=%2Fpgadmin4%2Fbrowser%2F' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

I am almost certain that the issue is not related to the pgAdmin installation as it is already working with the Kubernetes LoadBalancer service. I have found some workarounds to get rid of the loading page by adding some lines in the pgAdmin scripts (as it assumes pgAdmin has a bug), but I have been unsuccessful in implementing these workarounds.

I have also tried changing the Ingress configuration without any success. Is there any recommendation or a way to trace the issue and find the root cause?"

ingress implementation :

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: pgadmin-ingress
  annotations:
    kubernetes.io/ingress.class: azure/application-gateway
    appgw.ingress.kubernetes.io/ssl-redirect: "false"
    appgw.ingress.kubernetes.io/appgw-ssl-certificate: "devaks-cert"
    appgw.ingress.kubernetes.io/cookie-based-affinity: "true"
spec:
  rules:
    - http:
        paths:
          - path: /pgadmin4/*
            pathType: ImplementationSpecific
            backend:
              service:
                name: pgadmin
                port:
                  number: 80
Score:0
fr flag

We have a similar setup where Azure Application Gateway is in front of pgadmin deployed on AKS, and updating the following config resolves the issue for us, created extra file with the name config_distro.py

  X_CONTENT_TYPE_OPTIONS = ""    # default value is nosniff
  ENHANCED_COOKIE_PROTECTION = False
  X_XSS_PROTECTION = "0"  # default value is '1; mode=block'

For detailed description of these config check below URL https://www.pgadmin.org/docs/pgadmin4/latest/config_py.html

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.