directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
507 stars 204 forks source link

Thumbnail file request is HTTP instead of HTTPS. #2133

Open benjaminbours opened 4 years ago

benjaminbours commented 4 years ago

• Version of Directus 8.7.2 • Server, OS & Database Details Docker image 8.7.2

• Error Messages Client sent an HTTP request to an HTTPS server. • Steps to Reproduce Upload an image in a collection item. The file is correctly upload but the request to get the thumbnail of the assets is done in http, instead of https like the other request. • Relevant Info, Screenshots, Schema & Logs

Screenshot 2020-07-24 at 19 05 01

Here is my docker-compose

version: "3"
services:
  #
  # Database
  #
  mysql:
    image: mysql:5.7
    environment:
      MYSQL_DATABASE: "directus"
      MYSQL_USER: "${DB_USER}"
      MYSQL_PASSWORD: "${DB_PASSWORD}"
      MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
    ports: # Expose it if you want to access MySQL server
      - 3306:3306
    networks:
      - database
    volumes:
      - ./db_backup:/var/lib/mysql

  #
  # Directus instance.
  # This should serve directus and won't work before database
  # is properly installed by running the installer.
  #
  directus:
    image: directus/directus:v8.7.2-apache
    environment:
      # App
      # DIRECTUS_USE_ENV: 0
      DIRECTUS_ENV: "production"

      # These are now required, make sure to always set
      # to something unique while in production
      DIRECTUS_AUTH_PUBLICKEY: "${DIRECTUS_PUBLICKEY}"
      DIRECTUS_AUTH_SECRETKEY: "${DIRECTUS_SECRETKEY}"

      # Database
      DIRECTUS_DATABASE_HOST: "mysql"
      DIRECTUS_DATABASE_PORT: "3306"
      DIRECTUS_DATABASE_NAME: "directus"
      DIRECTUS_DATABASE_USERNAME: "${DB_USER}"
      DIRECTUS_DATABASE_PASSWORD: "${DB_PASSWORD}"

    # Uploads gets saved in uploads folder
    volumes:
      - ./data/config:/var/directus/config
      - ./data/uploads:/var/directus/public/uploads

    ports:
      - 8080:80

    networks:
      - database
      - http

  #
  # Caddy for HTTPS
  # https://caddyserver.com/docs/
  #
  caddy:
    image: caddy/caddy
    command: "caddy reverse-proxy --to http://directus"
    ports:
      - 8443:443
    networks:
      - http

networks:
  database:
  http:
benjaminbours commented 4 years ago

@rijkvanzanten I wanted to start investigating myself in order to fix it but I'm not able to connect a local instance of the admin web app to a docker based directus instance. I'm not able to contact the demo domain as well.

Screenshot 2020-07-31 at 16 05 33 (2)

What I am missing?

I have try the default yarn serve suppose to connect with demo app and also by setting the API_URL env variable. Both the same result, can't reach the api and these error. I really need to fix this, I want to contribute but I'm stuck, I just need a bit of help to get started.

I also don't understand why caddy, which seems to be setup to redirect http to https request is not able to do it in case of files request. @WoLfulus Do you have any idea?

On the detail view of a file, in the file library, the image is properly loaded. I would like to dig in the Vue stuff to understand why in this view it's ok and why in the others it's not. Screenshot 2020-07-31 at 16 20 25 (2)

First time I have to understand some Vue code and I need the Vue.js debugger dev tool. And to use it, I need an instance of the admin app in development mode. Which put me back to the issue I told you about connecting to a Directus api instance. I'm stuck.