Skip to content

Commit f21aa3d

Browse files
authored
Remove CORS workaround
@anirudhgarg @balag0 ------- cc: @ggailey777
1 parent 1c7f0ea commit f21aa3d

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

articles/azure-functions/functions-reference-python.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -631,36 +631,9 @@ All known issues and feature requests are tracked using [GitHub issues](https://
631631

632632
### Cross-origin resource sharing
633633

634-
Azure Functions supports cross-origin resource sharing (CORS). CORS is configured [in the portal](functions-how-to-use-azure-function-app-settings.md#cors) and through the [Azure CLI](/cli/azure/functionapp/cors). The CORS allowed origins list applies at the function app level. With CORS enabled, responses include the `Access-Control-Allow-Origin` header. For more information, see [Cross-origin resource sharing](functions-how-to-use-azure-function-app-settings.md#cors).
634+
Azure Functions supports cross-origin resource sharing (CORS). CORS is configured [in the portal](functions-how-to-use-azure-function-app-settings.md#cors) and through the [Azure CLI](/cli/azure/functionapp/cors). The CORS allowed origins list applies at the function app level. With CORS enabled, responses include the `Access-Control-Allow-Origin` header. For more information, see [Cross-origin resource sharing](functions-how-to-use-azure-function-app-settings.md#cors).
635635

636-
The allowed origins list [isn't currently supported](https://github.com/Azure/azure-functions-python-worker/issues/444) for Python function apps. Because of this limitation, you must expressly set the `Access-Control-Allow-Origin` header in your HTTP functions, as shown in the following example:
637-
638-
```python
639-
def main(req: func.HttpRequest) -> func.HttpResponse:
640-
641-
# Define the allow origin headers.
642-
headers = {"Access-Control-Allow-Origin": "https://contoso.com"}
643-
644-
# Set the headers in the response.
645-
return func.HttpResponse(
646-
f"Allowed origin '{headers}'.",
647-
headers=headers, status_code=200
648-
)
649-
```
650-
651-
Make sure that you also update your function.json to support the OPTIONS HTTP method:
652-
653-
```json
654-
...
655-
"methods": [
656-
"get",
657-
"post",
658-
"options"
659-
]
660-
...
661-
```
662-
663-
This HTTP method is used by web browsers to negotiate the allowed origins list.
636+
CORS is fully supported for Python function apps.
664637

665638
## Next steps
666639

0 commit comments

Comments
 (0)