Trouble Loading Assets Through Nginx Ingress for SonarQube Deployment on Kubernetes

Hello Community,

I am currently facing an issue with serving assets for my SonarQube deployment on a Kubernetes cluster using the Nginx Ingress Controller. When accessing the SonarQube UI through the browser, the assets (CSS, JS files) are not loading properly, and I receive the following error in the browser console:

Refused to apply style from 'https://internal.domain.com/js/outDLYDOPRS.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Here’s a brief overview of my setup:

  • SonarQube is deployed as a service named sonarqube-sonarqube running on port 9000 in my Kubernetes cluster.
  • I have set up an Nginx Ingress resource to route traffic to the sonarqube-sonarqube service.
  • The Ingress resource is configured with rules to route traffic for different paths (/, /js, /css) to the sonarqube-sonarqube service.
# MY INGRESS FILE 
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sonarqube-ingress
  namespace: sonarqube
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/add-base-url: "true"
spec:
  ingressClassName: nginx
  rules:
    - host: internal.domain.com
      http:
        paths:
          - pathType: Prefix
            path: "/"
            backend:
              service:
                name: sonarqube-sonarqube
                port:
                  number: 9000

Despite these configurations, the assets are not loading as expected. I have verified the service’s status, checked the Ingress Controller logs, and reviewed the Ingress resource status, but I couldn’t identify the issue.

Other Details

  • Helm Version v3.12.3
  • Kubectl Version v1.27
  • Sonarqube Helm Chat version sonarqube-8.0.2+754
  • Sonarqube App Version 9.9.2

Could anyone provide guidance or suggestions on how to troubleshoot and resolve this asset loading issue? Any help or pointers would be greatly appreciated!

Thank you in advance for your assistance!

Hello @Joish_Bosco and welcome to the community!

It seems weird to me that the message for stylesheet (CSS) indicates that the MIME type is text/html where it should be text/css

It might indicate that your nginx return an error, or sonarqube has not started correctly.
Could you try to curl the URL ‘https://internal.domain.com/js/outDLYDOPRS.css’ and check the response header and content, to find any clue on what could be wrong?
You could also check logs on the nginx controller and SonarQube.