kubernetes + ingress controller + lets encrypt + block mixed content

11/30/2019

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

-- Athos Oc
kubernetes
lets-encrypt
nginx-ingress
ssl

1 Answer

12/1/2019

I have found the solution, I write it for other person on my situation.

The problem were on one environment variable that I dont write on my deployment.

APP_URL .

On bookstack dockerhub repository talk about it:

-e APP_URL=http://your.site.here.xyz    for specifying the url your application will be accessed on (required for correct operation of reverse proxy)
-- Athos Oc
Source: StackOverflow