Fix CORS Errors on a MinIO Bucket: Community vs AIStor, and How to Test the Preflight with curl

by Opndrive12 min read
Sequence diagram of a browser preflight to MinIO: an allowed origin gets Access-Control-Allow-Origin back, a refused origin gets 204 with no CORS headers
On this page

Your browser app fails on its first request to the bucket. Firefox reports Reason: CORS header 'Access-Control-Allow-Origin' missing (MDN); Chromium’s internal name for it is MissingAllowOriginHeader (Chromium source).

A MinIO CORS error is harder to fix than the same error on Amazon S3, because where CORS lives depends on which MinIO you run: an S3-style bucket CORS document stores nothing on community MinIO (dummy-handlers.go). Find your build, set CORS at the layer it supports, then prove it with curl.

Nothing here was run against a live server. The community MinIO responses below are what MinIO’s source code says you should see, read from the archived minio/minio repository.

In this post:

Where MinIO sets CORS depends on the build

Community MinIO has no per-bucket CORS. It uses one server-wide origin list, api cors_allow_origin (or MINIO_API_CORS_ALLOW_ORIGIN), which defaults to * (config README). Its PutBucketCors answers NotImplemented. MinIO AIStor has the same server-wide list, plus per-bucket S3 XML rules set with mc cors set. A bucket with its own rules ignores the global list (AIStor docs).

Community (source build or legacy binary) AIStor
Server-wide origin list api cors_allow_origin / MINIO_API_CORS_ALLOW_ORIGIN, default * The same setting (core settings)
Per-bucket rules None: PutBucketCors returns NotImplemented, HTTP 501 (api-errors.go) S3 CORS specification, up to 100 rules per bucket (AIStor CORS)
GetBucketCors Always NoSuchCORSConfiguration, HTTP 404, even while CORS headers are served (dummy-handlers.go) The bucket’s rules as XML; mc cors get prints No bucket CORS configuration found. when there are none (mc cors get)
Exposed headers MinIO’s common S3 header list, including ETag (api-router.go) Per rule, with ExposeHeader (AIStor CORS)

The community MinIO repository was archived on 2026-04-25 and the edition is distributed as source code only; its legacy binaries “will not receive updates” (minio/minio). Forks of MinIO such as Silo have their own bucket CORS (Silo docs), so on a fork, check the fork’s docs.

Which browser error do you have?

What the browser reports Where to look
No Access-Control-Allow-Origin on the preflight The origin is not in MinIO’s list, or a proxy dropped the headers (cors.go)
No Access-Control-Allow-Origin on the real response The request reached another host or layer, or a proxy adds the header only on success codes (nginx)
More than one Access-Control-Allow-Origin Two layers both set CORS (MDN)
The preflight fails the “ok status” check Something in front of MinIO rejected the OPTIONS (cors.mojom)

Find out which MinIO you are running

A community MinIO server built with a plain go install reports the placeholder version DEVELOPMENT.GOGET (build-constants.go). Released MinIO binaries carry a timestamped release tag instead (build-constants.go), and we found no documentation that tells a legacy community binary from AIStor by its version.

The behavior settles it. Send PutBucketCors to a scratch bucket: community MinIO answers NotImplemented, HTTP 501 (api-errors.go), and AIStor accepts it (AIStor CORS). The Python program in the AIStor section runs this probe.

Warning: never probe a bucket in use. On AIStor the probe creates a bucket rule, and from then on the global origin list no longer applies to that bucket (mc cors set).

The error text you saw

A header you provided implies functionality that is not implemented is MinIO’s description of NotImplemented (api-errors.go): the server has no bucket CORS, so use the server-wide list below. The XML you provided was not well-formed or did not validate against our published schema. is MinIO’s MalformedXML (same file): on AIStor, check that the file is S3 CORS XML, not JSON (mc cors set).

Fix it on community MinIO: set the server-wide origin list

Set the list with mc admin config set, using the key from the MinIO config README. The alias and origins are example values:

Bash
mc admin config set <ALIAS> api cors_allow_origin="https://app.example.com,https://admin.example.com"

The value replaces the old list, so include every origin that should keep working; if the browser app is Opndrive, that origin is the address you open it at, and our Configure CORS guide has the exact command.

For community MinIO, build a current mc with go install github.com/minio/mc@latest; its repository was archived on 2026-07-14 (minio/mc).

Four ways the origin list goes wrong

  1. A space after a comma. MinIO splits the list on commas without trimming, so in https://a.example.com, https://b.example.com the second entry never matches (api.go, read from code). The AIStor docs write the list without spaces (AIStor CORS).
  2. A trailing comma. An empty entry fails the MinIO config with invalid cors value (api.go).
  3. An environment variable that wins. MinIO reads MINIO_API_CORS_ALLOW_ORIGIN before the stored config, so a stale variable makes mc admin config set look ignored (api.go, inferred from code). Environment settings are not dynamic: change the variable and restart. Otherwise api changes apply without a restart (config README).
  4. An origin that is not exact. Use the exact value the browser sends as Origin. MinIO matches entries with a wildcard matcher, so https://*.example.com works (api-router.go). We did not check case or trailing-slash handling.

Pasting AWS-style CORS JSON or XML stores nothing, and NoSuchCORSConfiguration from GetBucketCors is not the bug: community MinIO answers that for every bucket (dummy-handlers.go).

The default * is not sent as a literal *: MinIO echoes your origin with Access-Control-Allow-Credentials: true (api-router.go, rs/cors), so the browser’s rule against a wildcard with credentials (MDN) does not apply.

Fix it on AIStor: per-bucket rules with mc cors set

One bucket rule takes that bucket off the global list: “Once bucket-specific CORS is configured, global settings no longer apply to that bucket” (mc cors set). Put every origin the bucket needs into its rules, up to 100 per bucket (AIStor CORS).

With cors_allow_origin at *, AIStor echoes the origin with Access-Control-Allow-Credentials: true by default; a separate setting turns that off (AIStor CORS).

Console steps: the AIStor docs show no CORS screen, so use mc

The AIStor Console docs list no CORS tab for a bucket (managing objects), so use the AIStor Client (mc), one command per step; the mc cors commands are documented for the AIStor Client, and we did not check whether the archived community mc has them:

  1. Check what is active: mc cors get <ALIAS>/<BUCKET>. No bucket CORS configuration found. means the global list applies (mc cors get).
  2. Write cors.xml in the S3 CORS schema; mc cors set takes XML, not AWS-console JSON (mc cors set). This example follows the rule on the AIStor CORS page; add POST or DELETE only if your app uses them.

    XML
    <CORSConfiguration>
      <CORSRule>
        <AllowedOrigin>https://app.example.com</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
        <ExposeHeader>ETag</ExposeHeader>
        <MaxAgeSeconds>3600</MaxAgeSeconds>
      </CORSRule>
    </CORSConfiguration>
  3. Apply it: mc cors set <ALIAS>/<BUCKET> cors.xml, or pass - to read standard input (mc cors set).

  4. Confirm: mc cors get <ALIAS>/<BUCKET> prints the rules as XML (mc cors get).
  5. Run the curl test below.

Remove a bucket’s rules with mc cors remove <ALIAS>/<BUCKET> (AIStor CORS); a bucket with no CORS configuration falls back to the global settings (mc cors set).

The same thing from Python (boto3)

This program sets bucket rules through the S3 API, which AIStor accepts (AIStor CORS), and reads them back. On community MinIO it reports NotImplemented and exits 2, so it doubles as the build probe on a scratch bucket. Each put_bucket_cors call replaces any existing CORS configuration on the bucket (boto3 docs). We have not run this program; <...> values are placeholders.

Python
"""Set per-bucket CORS on MinIO AIStor, or report that the server is community MinIO.
Untested: this program has not been run against any server."""
import sys

import boto3
from botocore.config import Config
from botocore.exceptions import BotoCoreError, ClientError

ENDPOINT = "<MINIO_ENDPOINT>"   # the S3 API address, e.g. https://minio.example.com:9000, not the Console
REGION = "<REGION>"             # the region your MinIO server is configured with
BUCKET = "<BUCKET>"             # use a scratch bucket if you only want to probe the build
ACCESS_KEY = "<ACCESS_KEY>"
SECRET_KEY = "<SECRET_KEY>"

CORS = {
    "CORSRules": [
        {
            "AllowedOrigins": ["https://app.example.com"],  # every origin this bucket must allow
            "AllowedMethods": ["GET", "PUT", "HEAD"],
            "AllowedHeaders": ["*"],
            "ExposeHeaders": ["ETag"],
            "MaxAgeSeconds": 3600,
        }
    ]
}


def main() -> int:
    s3 = boto3.client(
        "s3",
        endpoint_url=ENDPOINT,
        region_name=REGION,
        aws_access_key_id=ACCESS_KEY,
        aws_secret_access_key=SECRET_KEY,
        config=Config(signature_version="s3v4", s3={"addressing_style": "path"}),
    )
    try:
        s3.put_bucket_cors(Bucket=BUCKET, CORSConfiguration=CORS)
        rules = s3.get_bucket_cors(Bucket=BUCKET)["CORSRules"]
    except ClientError as err:
        code = err.response["Error"]["Code"]
        status = err.response["ResponseMetadata"]["HTTPStatusCode"]
        if code == "NotImplemented":
            print("No per-bucket CORS here (community MinIO): "
                  "set api cors_allow_origin instead.", file=sys.stderr)
            return 2
        print(f"S3 error {code} (HTTP {status}): {err.response['Error'].get('Message', '')}",
              file=sys.stderr)
        return 1
    except BotoCoreError as err:
        print(f"Could not talk to {ENDPOINT}: {err}", file=sys.stderr)
        return 1
    print(f"CORS rules on {BUCKET}: {rules}")
    return 0


if __name__ == "__main__":
    sys.exit(main())

Test the preflight with curl, then the real request

Browsers send the preflight themselves: an OPTIONS with Origin, Access-Control-Request-Method and optionally Access-Control-Request-Headers (MDN). curl sends none of these unless you add them, and community MinIO treats an OPTIONS as a preflight only when Access-Control-Request-Method is present (rs/cors).

Aim at the MinIO S3 API endpoint, not the Console. The AIStor docs give the Console its own listen address, MINIO_CONSOLE_ADDRESS, separate from the server’s MINIO_ADDRESS (core settings), and a staff reply in an unresolved forum thread on this error asked about exactly this (Cloudron forum). Command 1, the preflight (example origin):

Bash
curl -i -X OPTIONS "<MINIO_ENDPOINT>/<BUCKET>/<KEY>" \
  -H "Origin: https://app.example.com" \
  -H "Access-Control-Request-Method: PUT" \
  -H "Access-Control-Request-Headers: content-type"

What MinIO’s source code says you should see on community MinIO for an allowed origin: 204, Access-Control-Allow-Origin: https://app.example.com (your origin echoed), Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers repeating your request, and Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers (rs/cors README, cors.go).

A refused origin on community MinIO also gets 204, just without any Access-Control-Allow-* header (cors.go). Read the Access-Control-Allow-Origin header, not the status. Amazon S3, by contrast, answers a refused request with 403 Forbidden (AWS CORS troubleshooting).

Community MinIO answers the preflight before authentication and routing, because its CORS handler wraps the whole server (server-main.go), so bad keys or a wrong bucket will not show up. Command 2 sends the real request to a presigned GET URL:

Bash
curl -i "<PRESIGNED_GET_URL>" -H "Origin: https://app.example.com"

Access-Control-Allow-Origin must be on this response too: Chromium’s MissingAllowOriginHeader is about the actual response, while a failed preflight is PreflightMissingAllowOriginHeader (cors.mojom).

On community MinIO a refused origin still gets 204, so check for the Access-Control-Allow-Origin header, not the status. Drawn from MinIO’s source code (cors.go, api-router.go), not from a live run.

After a change, run curl first, then hard-reload the page: browsers cache a preflight for 5 seconds by default, or for Access-Control-Max-Age up to each browser’s own cap (MDN).

Behind a reverse proxy, let one layer set CORS

Run command 1 against MinIO’s own port, then against the proxy hostname; the layer where the headers change is the one to fix. If MinIO and the proxy both add Access-Control-Allow-Origin, the browser rejects the response (MDN), so pick one layer. In nginx, three directives cause most of the trouble:

  • add_header applies only to certain success and redirect codes unless you add always, so a 403 or 404 loses the header and shows up as a CORS error (headers module).
  • Server-level add_header lines are not inherited by a location that has its own add_header (headers module).
  • To own CORS at the proxy, hide each Access-Control-* header MinIO sets, including Access-Control-Allow-Origin, Access-Control-Allow-Credentials and Access-Control-Expose-Headers (api-router.go, cors.go), with one proxy_hide_header line per header, then add your own (proxy module).

The proxy must pass OPTIONS and forward Origin, Access-Control-Request-Method and Access-Control-Request-Headers, and a caching proxy needs Origin in its cache key (AWS CORS troubleshooting). nginx does not pass a header set to an empty string (proxy module), so proxy_set_header Origin ""; leaves MinIO with no origin to answer.

Presigned URLs don’t get you past CORS

AWS calls presigned URLs “bearer tokens that grant access to those who possess them” (AWS presigned URLs): the signature authorizes the request, but CORS is a separate browser check. A browser PUT is not a simple request, so it preflights; a plain GET may not, but its response still needs Access-Control-Allow-Origin (MDN).

A “CORS error” with no HTTP status usually means the response never came from MinIO at all: look for a proxy error page or a redirect. That is our inference, not documented MinIO behavior.

Try Opndrive

Opndrive gives any S3-compatible bucket a Drive-like web interface you host yourself.
See it on GitHub or read the docs.

Curious about Opndrive?

Take a look at our FAQ to learn more.

Opndrive

Ready to take control of your S3 storage?

Connect your S3 bucket in minutes and start managing your files with Opndrive's beautiful, modern interface.

Build Opndrive with us

Live demos, reviews on your PRs, and a hand when you get stuck.

Be an early member
Join our Discord