0

I generate file's url by Minio and return for RestController with 302 HttpCode, but I need use external address with Nginx location. Minio temp url has X-Amz-Signature header and url for service contains in signature that why I can't redirect user by nginx. For examples: host: minio-host port: minio-port bucket: file filename: 333/test.jpg

minio's url: http://minio-host:minio-port/file/333/test.jpg But, I want to use nginx location (http://my-host/minio) If I use nginx, I can't get file, because X-Amz-Signature contains host = http://minio-host:minio-port What should I do to use nginx? I started minio and nginx in docker

I tried to disabled the header change in nginx

Danzxz
  • 15
  • 3

1 Answers1

0

I had similar issues on local.

Solution 1, is that you need to create the presignedUrl through the nginx with your public URL, not through one of the docker-network.

Solution 2, generate the link through the mc client. This worked also. But hardly you can generate every link through the mc, depends on what you are doing.

You can also refere to my answer to a similar question: https://stackoverflow.com/questions/74656068/minio-how-to-get-right-link-to-display-image-on-html/74717273#74717273:%7E:text=If%20you%20have%20Minio%20running%20in%20a%20container%2C%20it%20is%20always%20a%20mess%20with%20127.0.0.1%20or%20localhost:~:text=Try%20to%20generate%20the%20link%20with%20the%20minioclient.

Last. I used an sample of docker-compose with quay.io image and nginx. Here even the links greated through the browser UI, didnt worked.

This issue i solved using the bitnami/minio image.

try this:

version: '3.7'

services:
   minio: 
    container_name: minio
    image: bitnami/minio
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
      
    healthcheck:
      test: ["CMD", "curl", "-f", 
      "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3
    networks:
      - mynetwork
    volumes:
      - miniodata:/data


networks:
  mynetwork
volumes:
  miniodata:

You can also put an entry in your hosts file on your host.

127.0.0.1 minio.local

and then use the UI with Http://minio.local:9001

This should generate the right presignedURL.

If that all works fine you can create a multiple node installation and use nginx as Loadbalancer.

Ralle Mc Black
  • 1,065
  • 1
  • 8
  • 16