Skip to content

Commit 059669a

Browse files
Secure web server binding and enforce HTTPS
- Remove hardcoded insecure HTTP binding to 0.0.0.0:8080 in Program.cs. - Add app.UseHttpsRedirection() middleware to enforce secure traffic. - Introduce appsettings.json with secure default Kestrel configuration (localhost only). Co-authored-by: antarr <974295+antarr@users.noreply.github.com>
1 parent 6609f54 commit 059669a

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Withings.Example/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
var app = builder.Build();
3939

40+
app.UseHttpsRedirection();
4041
app.UseSession();
4142

4243
app.MapGet("/", () => Results.Redirect("/api/oauth/authorize", permanent: true));
@@ -201,4 +202,4 @@
201202
return Results.Json(activity);
202203
});
203204

204-
app.Run("http://0.0.0.0:8080");
205+
app.Run();

Withings.Example/appsettings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Kestrel": {
3+
"Endpoints": {
4+
"Http": {
5+
"Url": "http://127.0.0.1:8080"
6+
},
7+
"Https": {
8+
"Url": "https://127.0.0.1:8081"
9+
}
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)