Skip to content

Commit 8e6eb24

Browse files
authored
[async-request-reply] This change updates the Function App to use HTTPS instead of HTTP. (#439)
* Update URLs to use HTTPS and set environment for Azure Functions * Remove redundant AZURE_FUNCTIONS_ENVIRONMENT setting from local.settings.json
1 parent 02f8548 commit 8e6eb24

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎async-request-reply/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The typical way to generate a SAS token in code requires the storage account key
9898
Content-Length: 155
9999
Content-Type: application/json; charset=utf-8
100100
Date: Wed, 13 Dec 2023 20:18:55 GMT
101-
Location: http://<appservice-name>.azurewebsites.net/api/RequestStatus/<guid>
101+
Location: https://<appservice-name>.azurewebsites.net/api/RequestStatus/<guid>
102102
```
103103

104104
Using a browser open the url from the _Location_ field in the response. A file with the data you have sent will be downloaded.

‎async-request-reply/deploy.bicep‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ resource functionApp 'Microsoft.Web/sites@2025-03-01' = {
202202
name: 'DataStorage__blobServiceUri'
203203
value: 'https://${dataStorageAccount.name}.blob.${environment().suffixes.storage}'
204204
}
205+
{
206+
name: 'AZURE_FUNCTIONS_ENVIRONMENT'
207+
value: 'Production'
208+
}
205209
]
206210
}
207211
functionAppConfig: {

‎async-request-reply/src/AsyncOperationStatusChecker.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous,
2727
else
2828
{
2929
// ** If it's NOT present, then we need to back off, so depending on the value of the optional "OnPending" parameter choose what to do. **
30-
string rqs = $"http://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api/RequestStatus/{thisGUID}";
30+
string scheme = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT") == "Development" ? "http" : "https";
31+
string rqs = $"{scheme}://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api/RequestStatus/{thisGUID}";
3132

3233
switch (OnPending)
3334
{

‎async-request-reply/src/AsyncProcessingWorkAcceptor.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Anonym
1818
}
1919

2020
var reqid = Guid.NewGuid().ToString();
21-
22-
var rqs = $"http://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api/RequestStatus/{reqid}";
21+
string scheme = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT") == "Development" ? "http" : "https";
22+
var rqs = $"{scheme}://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api/RequestStatus/{reqid}";
2323

2424
var messagePayload = JsonConvert.SerializeObject(customer);
2525
var message = new ServiceBusMessage(messagePayload);

0 commit comments

Comments
 (0)