Nginx rules and css not applies on starter kit

Hi,

I have a problem with css not applied with my nginx rules. You could see that on https://idees.reycoyrehourcq.me/

I don’t understand where is the problem, any help appreciated to resolve this :

server {
        listen 80;
        listen [::]:80;
        server_name idees.reycoyrehourcq.me;

        root /app;

        index index.html index.php;

         location /assets {
            if (!-e $request_filename) {
             rewrite "^/(.+)\.([0-9]{10})\.(js|css)$" /$1.$3 break;
            }
         }


        # removes trailing slashes (prevents SEO duplicate content issues)
        if (!-d $request_filename) {
                rewrite ^/(.+)/$ /$1 permanent;
        }

        # site links
        location / {
                try_files $uri $uri/ /index.php?$uri&$args;
        }

        # prevent clients from accessing to backup/config/source files
        location ~ (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
                deny all;
        }

        location ~ \.php$ {
                try_files $uri = 404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME     $request_filename;
                fastcgi_read_timeout 600;
                fastcgi_index index.php;
        }

}

I use these nginx conf in a docker with image webdevops/php-nginx:8.1 and kirby template installed with git clone on /app folder

The problem why this happens is that the css is requested via http while the rest via https, so it seems that your https redirect isn’t working properly?

1 Like

You’re right, i see that on source code of index, i search why.

The traefik label for my docker-compose are relativly simple :

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.idees.rule=Host(`idees.reycoyrehourcq.me`)" 
      - "traefik.http.routers.idees.entrypoints=websecure" 
      - "traefik.http.routers.idees.tls.certresolver=le" 
      - "traefik.http.routers.idees.tls=true"

And my traefik.yml contain :

entryPoints:
  web_redirect:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: ":443"
    http:
      tls:
        certResolver: le
        domains:
          - main: "{{ acme_domain }}"
          - sans:
              - "*.{{ acme_domain }}"

Edit :

It seems this is a problem of “mixed active content”, my navigator block files.
I try to add this to my docker-compose running php+nginx behind traefik, without success :

      - "traefik.http.middlewares.secure-headers.headers.customrequestheaders.X-Forwarded-Proto=https"

Have you tried to set the url in your site/config/config.php?

Can’t help with traefic/nginx setup.

Yep, you’re right, adding URL + X-Forward-Proto to traefik solve the problem, but i have a new problem on panel now, i open a new thread.