| ... | ... | @@ -330,7 +330,11 @@ fn fail(response: *http.Response, comptime err: string, args: anytype) !void { |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | fn redirectUri(alloc: std.mem.Allocator, request: http.Request, callbackPath: string) !string { |
| 333 | | return try std.fmt.allocPrint(alloc, "http://{s}{s}", .{ request.host().?, callbackPath }); |
| 333 | const headers = try request.headers(alloc); |
| 334 | const xproto = headers.get("X-Forwarded-Proto") orelse ""; |
| 335 | const maybe_tls = std.mem.eql(u8, xproto, "https"); |
| 336 | const proto: string = if (maybe_tls) "https" else "http"; |
| 337 | return try std.fmt.allocPrint(alloc, "{s}://{s}{s}", .{ proto, request.host().?, callbackPath }); |
| 334 | 338 | } |
| 335 | 339 | |
| 336 | 340 | fn fixId(alloc: std.mem.Allocator, id: json.Value) !string { |