Skip to content

Commit 03d97e4

Browse files
committed
Set allow all origins in azure functions (both deployed in Azure and locally). Also, fixed Dockerfile.
1 parent dbd0945 commit 03d97e4

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

Deploy/deployment.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"type": "Microsoft.Web/sites",
6363
"kind": "functionapp",
6464
"name": "[variables('function_name')]",
65-
"apiVersion": "2016-03-01",
65+
"apiVersion": "2016-08-01",
6666
"location": "[parameters('location')]",
6767
"properties": {
6868
"name": "[variables('function_name')]",
@@ -92,7 +92,10 @@
9292
"name": "WEBSITE_NODE_DEFAULT_VERSION",
9393
"value": "8.11.1"
9494
}
95-
]
95+
],
96+
"cors": {
97+
"allowedOrigins": ["*"]
98+
}
9699
},
97100
"clientAffinityEnabled": false,
98101
"reserved": false

Source/.dockerignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.vs
6+
**/.vscode
7+
**/*.*proj.user
8+
**/azds.yaml
9+
**/charts
10+
**/bin
11+
**/obj
12+
**/Dockerfile
13+
**/Dockerfile.develop
14+
**/docker-compose.yml
15+
**/docker-compose.*.yml
16+
**/*.dbmdl
17+
**/*.jfm
18+
**/secrets.dev.yaml
19+
**/values.dev.yaml
20+
**/.toolstarget

Source/SmartHotel360.Website/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ WORKDIR /app
33
EXPOSE 80
44

55
FROM microsoft/dotnet:2.2.100-preview1-sdk-alpine AS build
6+
ENV BuildingDocker true
67
WORKDIR /src
7-
COPY SmartHotel360.PublicWeb.csproj .
8+
COPY SmartHotel360.Website.csproj .
89
RUN dotnet restore
910
COPY . .
1011
RUN dotnet build -c Release -o /webapp
@@ -28,4 +29,4 @@ FROM base AS final
2829
WORKDIR /app
2930
COPY --from=publish /webapp .
3031
COPY --from=node /src/wwwroot ./wwwroot
31-
ENTRYPOINT ["dotnet", "SmartHotel360.PublicWeb.dll"]
32+
ENTRYPOINT ["dotnet", "SmartHotel360.Website.dll"]

Source/SmartHotel360.Website/SmartHotel360.Website.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</Target>
5353

5454

55-
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
55+
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish" Condition="'$(BuildingDocker)' == '' ">
5656

5757
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
5858
<Exec WorkingDirectory="$(SpaRoot)" Command="npm rebuild node-sass" />

Source/SmartHotel360.WebsiteFunction/local.settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"MicrosoftVisionNumTags": "10",
1212
"AzureSignalRConnectionString": "<Connection String to the SignalR Service instance>",
1313
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
14+
},
15+
"Host": {
16+
"CORS": "*"
1417
}
1518
}

0 commit comments

Comments
 (0)