aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-02 00:07:17 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-02 00:07:17 -0800
commitd899e0ac6f2208e56bd0936c43035eacd6d69987 (patch)
tree0610b7c181cfec48c14387575c63221383bc70b2
parent3915e01cfbb35a0953255d7bb5e186f8840c852f (diff)
downloadbun-d899e0ac6f2208e56bd0936c43035eacd6d69987.tar.gz
bun-d899e0ac6f2208e56bd0936c43035eacd6d69987.tar.zst
bun-d899e0ac6f2208e56bd0936c43035eacd6d69987.zip
[bun dev] Detect HTTPS via `Upgrade-Insecure-Requests`
Diffstat (limited to '')
-rw-r--r--src/http.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http.zig b/src/http.zig
index bccfcce3e..f101b5b38 100644
--- a/src/http.zig
+++ b/src/http.zig
@@ -129,6 +129,11 @@ pub const RequestContext = struct {
if (protocol == null) {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
determine_protocol: {
+ if (this.header("Upgrade-Insecure-Requests") != null) {
+ protocol = "https";
+ break :determine_protocol;
+ }
+
if (this.header("X-Forwarded-Proto")) |proto| {
if (strings.eqlComptime(proto, "https")) {
protocol = "https";