dockersymfonyhttphttps

Symfony or Nginx is forcing a redirect to https in a Docker test environment


please help. I'm having a problem with a droplet in DigitalOcean with a Symfony app. The app portal works fine, but when I log in to a module with security (username and password), the styles and JS aren't loaded, and all links are redirected to https. This doesn't happen on my local dev machine, and the links are displayed as http.

I have two containers: the first with a Symfony 6 app and the second with Nginx for reverse proxy. In DigitalOcean, I set up the $15 Managed PostgreSQL, which has SSL certificates. Could this be forcing the modules to work with an https login?

I set up another droplet to start from scratch and installed PostgreSQL on the droplet, but the problem still persists. I don't know if Symfony or Nginx are forcing the links to be redirected to https. I'm logging in via IP, but I haven't configured the domain yet.

All this is for a test server

# This script is for the nginx dockerfile
server {
    listen 80;
    index index.php;
    server_name localhost;
    root /appdata/www/public;
    client_max_body_size 10M;

    error_log /var/log/nginx/project_error.log;
    access_log /var/log/nginx/project_access.log;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\\.php(/|$) {
        fastcgi_pass app:3020;
        fastcgi_split_path_info ^(.+\\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
    }

    location ~ \\.php$ {
        return 404;
    }
}

services:

  app:
    image: superarchihub:superarchi:latest
    container_name: superarchi-app
    networks:
      - superarchi-network
    volumes:
      - service-data:/appdata/www/public
      - ./media:/appdata/www/public/media
      - ./var:/appdata/www/var/log

  web:
    image: superarchihub:ngynxsuperarchi:latest
    container_name: superarchi-web
    ports:
      - '8030:80'
    volumes:
      - service-data:/appdata/www/public
      - ./media:/appdata/www/public/media
    links:
      - app
    networks:
      - superarchi-network
    depends_on:
      - app

  mailer:
    container_name: superarchi-mailer
    image: axllent/mailpit
    ports:
      - "1040:1025"
      - "8040:8025"
    environment:
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1
    networks:
      - superarchi-network

networks:
  superarchi-network:
    external: true

volumes:
  service-data:
    external: true

Any ideas, thanks in advance


Solution

  • The problem was solved, after so much debugging the problem was an HTML tag <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> , nothing to do with symfony or nginx