kubernetes + ingress controller + lets encrypt + bock mixed content

Thanks for taking the time to read this.

I am testing a cluster of kubernetes in digitalocean.

I have installed an ingress controler with cert-manager and letsencript (I followed this guide https://cert-manager.io/docs/tutorials/acme/ingress/) and when I launch some deployment I have problems with the files that are not in the root (Blocked loading mixed active content).

To give a more concrete example, I’m trying to put the application bookstack, if I not active tls, I see everything correctly. On the other hand if I activate tls I see everything without css and in the console I see that there are files that have been blocked by the browser.
enter image description here

On the other hand if I do a port-forward I see it correctly (http://localhost:8080/) -> note http and not https
enter image description here

I have done the test also with a wordpress, with the same problem, the main page is seen without the styles. In this case, for wordpress there is a plugin, that if you get into the backend (browsing the page without css is a torture) and install it solves the problem (this is the plugin https://es.wordpress.org/plugins/ssl-insecure-content-fixer/). On plugin i have to check “HTTP_X_FORWARDED_PROTO” to make it work.
But I’m realizing that it’s a recurring problem, and I think there are concepts that are not clear to me and I do not know very well what I have to do.

Here is an example of the ingress controller

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: bookstack
  annotations:
    kubernetes.io/ingress.class: "nginx"    
    # cert-manager.io/issuer: "letsencrypt-staging"
    cert-manager.io/issuer: "letsencrypt-prod"
spec:
  tls:
  - hosts:
    - k1.athosnetwork.es
    secretName: tls-bookstack
  rules:
  - host: k1.athosnetwork.es
    http:
      paths:
      - path: /
        backend:
          serviceName: bookstack
          servicePort: 80

Thanks very much for your time

Leave a Reply

Your email address will not be published. Required fields are marked *