Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINIO_API_CORS_ALLOW_ORIGIN environment variable not working on minio docker image #11258

Closed
SylvainBigonneau opened this issue Jan 11, 2021 · 4 comments

Comments

@SylvainBigonneau
Copy link

SylvainBigonneau commented Jan 11, 2021

Whatever I put in the MINIO_API_CORS_ALLOW_ORIGIN (as documented here), I cannot reach my minio server (ran on a docker container on my local machine) from my web app.

Expected Behavior

Using its docker image, Minio server requests from a web browser should work if the appropriate MINIO_API_CORS_ALLOW_ORIGIN environment variable is set on the docker container.

Current Behavior

Here is the docker-compose.yml configuration I am using or the minio image:

version: '3.2'

services:
  # ...
  minio:
    image: "minio/minio"
    environment:
      MINIO_ACCESS_KEY: XXXXXX
      MINIO_SECRET_KEY: XXXXXX
      MINIO_API_CORS_ALLOW_ORIGIN: '*'
    ports:
      - "9000:9000"
    command: "server /data"
    network_mode: host
    volumes:
      - "minio_data:/data"
volumes:
  minio_data:

Despite what I believe is a correct configuration, here are the responses from PUT requests to minio from my web app:

OPTIONS     localhost:9000    CORS Missing Allow Origin
PUT         localhost:9000    NS_ERROR_DOM_BAD_URI

I believe this happens because my "Allow Origin *" instruction has not been processed?

Context

I am trying to recreate an AWS S3 setup on my local machine to match my web app's production infrastructure. It used to work perfectly fine with minio, but somehow now I keep getting those pesky CORS errors! :(

Regression

Probably not

Your Environment

  • Version used (minio --version): RELEASE.2020-12-18T03-27-42Z
  • Server setup and configuration: see "Current behavior" for docker-compose setup
  • Operating System and version (uname -a): Linux xxxxx 5.8.0-36-generic Adding HEAD verb to minioapi #40-Ubuntu SMP Tue Jan 5 21:54:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
@harshavardhana
Copy link
Member

  MINIO_API_CORS_ALLOW_ORIGIN: '*'

This is default I don't know why you would need it.

@SylvainBigonneau
Copy link
Author

  MINIO_API_CORS_ALLOW_ORIGIN: '*'

This is default I don't know why you would need it.

Oh okay, so it should even work without it then! This issue actually seems to be the same as #11111 so I may close this and continue the conversation there...

@harshavardhana
Copy link
Member

Oh okay, so it should even work without it then! This issue actually seems to be the same as #11111 so I may close this and continue the conversation there...

Of course it works as I showed in #11111 your client is not setting the Origin: header that is required here.

@harshavardhana
Copy link
Member

#11111 (comment) is the relevant comment

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants