CORS Issue with Azure Functions inside AKS Cluster

我的未来我决定 提交于 2021-01-07 06:49:24

问题


I have a AKS Cluster in Azure which is running my Azure functions project. I got it working by following this guide.

https://markheath.net/post/azure-functions-aks-keda

The service is running, however any requests from my site fail with a CORS error. If you notice on the guide the CORS option is set to * in the local.settings.json file.

I noticed that azure functions does not seem to read the local.settings.json or settings.json files when running inside a container.

I am not sure why but to get it running locally I had to set the connection strings as environment variables.

It looks like the func kubernetetes deploy --dry-run > deploy.yml does the same, as the yaml looks something like this:

data:
  AzureWebJobsStorage: ConnectionStringHere
  AzureSignalRConnectionString:  ConnectionStringHere
  AzureBlobStorage:  ConnectionStringHere 
  FUNCTIONS_WORKER_RUNTIME: ZG90bmV0
  FUNCTIONS_V2_COMPATIBILITY_MODE: dHJ1ZQ==
apiVersion: v1
kind: Secret
metadata:
  name: my-app-live
  namespace: default
---
apiVersion: v1 

Note, there is no reference to CORS in there at all, even against the LoadBalancer.

I have done some research and it looks like others change the load balancer to nginx as a reverse proxy to deal with this. I am not sure this an option for me or what the repercussions would be as this is using DurableFunctions and KEDA for scaling and I don't want to do anything that might break that functionality.

The FunctionApp is written in C#

I am very new to Kubernetes so please give as much detail as possible if you can help.

来源:https://stackoverflow.com/questions/65074215/cors-issue-with-azure-functions-inside-aks-cluster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!