惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
Malwarebytes
Malwarebytes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
F
Future of Privacy Forum
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
S
Securelist
K
Kaspersky official blog
S
Schneier on Security
T
ThreatConnect
T
Tenable Blog
Spread Privacy
Spread Privacy
T
True Tiger Recordings
AWS News Blog
AWS News Blog
F
Fox-IT International blog
量子位
T
Threatpost
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
GbyAI
GbyAI
宝玉的分享
宝玉的分享
腾讯CDC
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
Cyberwarzone
Cyberwarzone
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
U
Unit 42
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
小众软件
小众软件
A
About on SuperTechFans
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
美团技术团队
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

Hacker News

Claude Is Not Your Architect. Stop Letting It Pretend. CBP updated its electronic device search directive in Jan 2026 Don't know where your data is from? Bayesian modeling for unknown coordinates Senior Frontend Engineer at Flick | Y Combinator AI Chip Component Costs: Memory at 63% | Epoch AI Ruby for Good When (if ever) it's appropriate to make jokes before the US Supreme Court Computer and coding books from Usborne | Usborne | Be Curious No Juniors Today, No Seniors in 2031 abyss * your_dotfiles_are_not_a_distro The seed oil panic is hurting my cardiac patients FreeBSD Foundation Executive Director Tries Daily Driving FreeBSD On Laptop Did a British SMS Honeypot Discover Election Fraud in the US Midterms? Bringing BASIC back: Microsoft’s 6502 BASIC is now Open Source DeepSeek reasonix, DeepSeek native coding agent with high caching and low cost Childhood Computing - Susam Pal What Matters in Practical Learned Image Compression Mastering Dyalog APL — Mastering Dyalog APL The Worlds Left To Conquer — Ludicity Greg Brockman: Inside the 72 Hours That Almost Killed OpenAI All Lean Books And Where To Find Them ‘AI washing’: firms are scrambling to rebrand themselves as tech-focused Toise Amazon Web Services - Four Years and Out The C++ Standard Library Has Been Walking Itself Back for Fifteen Years AMD Customer Community (Now Go Bang!) The C64 Dead Test Font How Alexander Grothendieck Revolutionized 20th-Century Mathematics | Quanta Magazine The day my ping took countermeasures Shooting near White House: Suspect killed after opening fire on Secret Service agents Justice Department scrubs website of news releases about Jan. 6 defendants | AP News wake up! 16b 声明式部分更新 | Blog | Chrome for Developers VC Dimension and the Fundamental Theorem of Statistical Learning — from Scratch ICE Awards $25 Million Iris-Scanning Contract to Bi2 Technologies my i3-emacs integration Image - Bun Don't Roll Your Own ... Byrne's Euclid Toxic chemical leak at a manufacturing facility in Orange County Google I/O 2026: Software engineering at the tipping point A self-powered computer in actual credit-card size (~1mm thick) Pardon MIE? - ironPeak Blog Air France and Airbus found guilty of manslaughter over 2009 plane crash GitHub - DamRsn/NeuralNote: Audio Plugin for Audio to MIDI transcription using deep learning. It's time to talk about my writerdeck GitHub - tejpalv/cc-wiki: Turn your ~/.claude history into a shareable Quartz knowledge base. Texas woman arrested for Facebook post about town water quality Iowa lawmakers move to mandate students take Center for Intellectual Freedom classes amid low enrollment JWT is a scam and your app doesn't need it Reverse engineering circuitry in a Spacelab computer from 1980 Evaluating SPEC CPU2026 Show HN: I built a RAG and knowledge graph agent that runs locally Italy moves to Airbus A330 tankers in major NATO-aligned shift Lisp in Vim - Susam Pal z386: An Open-Source 80386 Built Around Original Microcode Oura says it gets government demands for user data. Will it share how many? On the <dl> The Art of Money Getting – Cool Tools The spell that wouldn't leave · mahl.me 80386 microcode disassembled « Reenigne blog Judson's Last Ride twitter.com Making Deep Learning go Brrrr From First Principles DHS Quits Granting Green Cards–Almost DeepSeek 将对其旗舰 AI 模型实施永久性 75% 折扣 US tech firms share Dutch regulator officials’ names with senate The FBI Wants ‘Near Real-Time’ Access to US License Plate Readers -​-dangerously-skip-reading-code BambuStudio has been violating PrusaSlicer AGPL license since their fork Spanish Court Declines to Fine NordVPN over LaLiga Piracy Blocking Order GitHub - amatsuda/rubish The White House is ordering agencies to place its new app on all employees’ government phones Google Is Killing ChromeOS: Aluminium OS, Its Android-Based Replacement New rule requires most green-card applicants to apply from outside U.S. Is AI Profitable Yet? FBI director&#x27;s Based Apparel site has been spotted hosting a &#x27;ClickFix&#x27; attack TikTok disproportionately served anti-Democratic videos during the 2024 election SpaceX successfully launches prototype of Starship rocket SpaceX just launched Starship V3 &mdash; its most powerful megarocket yet &mdash; into space for the 1st time in… GitHub - bkawa-bot/planet-maiko: A local dev tool where your agents are weird alien dogs. Would you let them in? Why We&#x27;ve Filed a Referendum Don't just 'quote' the AI Ebola outbreak now third largest recorded and "spreading rapidly" Client Challenge Shipping a Laptop to a Refugee Camp in Uganda Hengefinder: Finding When the Sun Aligns With Your Street Green Card Seekers Must Leave U.S. to Apply, Trump Administration Says GitHub - anomalyco/models.dev: An open-source database of AI models. Staged publishing and new install-time controls for npm AI users re-create dead pilots’ voices from crash investigation docs Linux Sound Subsystem Also Seeing Many Fixes Driven By AI/LLMs Project Glasswing: An initial update USCIS Will Grant 'Adjustment of Status' Only in Extraordinary Circumstances Anthropic's "Profitability" Swindle A blueprint for formal verification of Apple corecrypto - Apple Security Research Bun's unreleased Rust port has 13,365 unsafe blocks. Most can be removed. The ten steps towards a dictatorship KanBots — a kanban that runs parallel agents A scoping review of bicycling interventions’ impacts on psychological, social, affective, and cognitive well-being
Configuring a Go HTTP Server for Unencrypted HTTP/2 (h2c)
2026-05-20 · via Hacker News

In our application, we use long-lived server-sent event streams (SSE). These are set up to have a really long timeout and lifetime - 15 minutes in our setup. However, Google Cloud Run has a known issue in that client disconnects are not propagated to Cloud Run when using HTTP/1.1 to communicate with the backend service. Thus, I started looking into using HTTP/2 for services.

Cloud Run terminates TLS at the frontend, but can forward traffic as either HTTP/1.1 or HTTP/2 cleartext (h2c) traffic. Normally, HTTP/2 always uses TLS, but HTTP clients and servers can often be configured to use a cleartext version of the protocol. Cloud Run also makes you select the protocol to be used. This is basically the “HTTP/2 with Prior Knowledge” setup noted in RFC 9113, section 3.3.

Configuring a Go server for HTTP/2 cleartext

Our first cut of h2c support predated the Go 1.24 changes I will go into more detail below. Most posts and guides on the internet will point you toward the old outdated approach, but I’ve included it below so it is easier to see the before and after, and migrate your own code if you need to.

Before Go 1.24 (old approach)

To use h2c, you had to use the golang.org/x/net/http package, and go through a convoluted setup.

import (
	"net/http"
	"golang.org/x/net/http2"
	"golang.org/x/net/http2/h2c"
)

handler := ...
// the existing `handler` must be wrapped, attached to server, then configured
h2s := &http2.Server{}
handler = h2c.NewHandler(handler, h2s)
srv := &http.Server{
	Addr:              fmt.Sprintf("%s:%d", "", 9888),
	Handler:           handler,
	ReadHeaderTimeout: 5 * time.Second,
	ReadTimeout:       10 * time.Second,
	WriteTimeout:      35 * time.Second,
	// https://cloud.google.com/load-balancing/docs/https/request-distribution#timeout-bes
	IdleTimeout: 620 * time.Second,
}
err = http2.ConfigureServer(srv, h2s)
if err != nil {
    ...
}

Go 1.24+ (new approach)

With Go 1.24, no x/net/http2/h2c wrapper is needed anymore, and the setup is a lot more readable. You can configure protocols directly on http.Server.

Reference: Go 1.24 net/http release notes.

handler := ...
srv := &http.Server{
	Addr:              fmt.Sprintf("%s:%d", "", 9888),
	Handler:           handler,
	ReadHeaderTimeout: 5 * time.Second,
	ReadTimeout:       10 * time.Second,
	WriteTimeout:      35 * time.Second,
	// https://cloud.google.com/load-balancing/docs/https/request-distribution#timeout-bes
	IdleTimeout: 620 * time.Second,
}
srv.Protocols = new(http.Protocols)
srv.Protocols.SetHTTP1(true)
srv.Protocols.SetUnencryptedHTTP2(true)

Testing locally before deployment

Testing is pretty simple. This command will fail if HTTP/2 cleartext isn’t set up properly.

curl -i --http2-prior-knowledge http://localhost:9888

Terraform Cloud Run configuration

Once your Go service can speak HTTP/2 cleartext, it needs to be configured in Cloud Run appropriately. If you’re doing it via the Cloud Run console, follow the HTTP/2 for services documentation. We’re doing it via terraform - this snippet below gives a general idea of the configuration.

# Many settings have been omitted that are not relevant to this post.
resource "google_cloud_run_v2_service" "api" {
  name                 = "api"
  location             = var.primary_region
  invoker_iam_disabled = true
  ingress              = "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"

  template {
    containers {
      ...
      ports {
        name           = "h2c"
        container_port = 9888
      }
    }

    # Default is 80; with idle SSE connections, we can easily scale higher.
    max_instance_request_concurrency = 200
    # Default is 300s, but with SSE, we want to allow long-lived connections.
    timeout = "900s"
  }

  lifecycle {
    ignore_changes = [client, client_version, template[0].revision]
  }
}

No real changes were needed at the load balancer level, since HTTPS is used to communicate with Serverless NEGs, and it seems like it properly upgrades the connection to HTTP/2 during that negotiation. Also, the default timeouts for serverless backends is 60 minutes, not 30 seconds like some other backends.