Skip to content

Commit d2f2b5c

Browse files
authored
Merge pull request #112901 from ggailey777/patch-7
Remove CORS workaround
2 parents 214ce9a + 1cd66fa commit d2f2b5c

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

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

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -625,42 +625,15 @@ from os import listdir
625625

626626
We recommend that you maintain your tests in a folder separate from the project folder. This keeps you from deploying test code with your app.
627627

628-
## Known issues and FAQ
629-
630-
All known issues and feature requests are tracked using [GitHub issues](https://github.com/Azure/azure-functions-python-worker/issues) list. If you run into a problem and can't find the issue in GitHub, open a new issue and include a detailed description of the problem.
631-
632-
### Cross-origin resource sharing
633-
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).
635-
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:
628+
## Cross-origin resource sharing
640629

641-
# Define the allow origin headers.
642-
headers = {"Access-Control-Allow-Origin": "https://contoso.com"}
630+
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).
643631

644-
# Set the headers in the response.
645-
return func.HttpResponse(
646-
f"Allowed origin '{headers}'.",
647-
headers=headers, status_code=200
648-
)
649-
```
632+
CORS is fully supported for Python function apps.
650633

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-
```
634+
## Known issues and FAQ
662635

663-
This HTTP method is used by web browsers to negotiate the allowed origins list.
636+
All known issues and feature requests are tracked using [GitHub issues](https://github.com/Azure/azure-functions-python-worker/issues) list. If you run into a problem and can't find the issue in GitHub, open a new issue and include a detailed description of the problem.
664637

665638
## Next steps
666639

0 commit comments

Comments
 (0)