Skip to content

Does Flask-CORS fully support IPv6 origins? #396

@omar-ashraf1488

Description

@omar-ashraf1488

Hi there,

I encountered a situation with IPv6 localhost addresses and wanted to clarify whether Flask-CORS officially supports them.

Setup:

Flask backend running on port 5001.

Flask-CORS configuration:

from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app, origins=["http://[::1]:8000"])  # IPv6 localhost

@app.route("/origin")
def origin():
    return "Hello"

Frontend accessed via: http://[::1]:8000/client.html

Problem:

The browser sends Origin: http://[::1]:8000

Flask-CORS does not seem to add the Access-Control-Allow-Origin header, and the browser blocks the request.

Switching to IPv4 (http://127.0.0.1:8000) works as expected.

Question:

  • Is this a known limitation?
  • Does Flask-CORS currently fully support IPv6 origins?

Thanks for any clarification or guidance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions