gcp
GCP Load Balancer 404 Fix for URL Map Mismatches
Eliminate 404 responses caused by incorrect host rules or backend path routing.
April 21, 2026•1 min read
#gcp#load-balancer#404
Problem
The Google Cloud load balancer responds with 404 for valid application routes.
Root Cause
The URL map points requests to a default backend because the host rule or path matcher is incomplete.
Fix
Code
gcloud compute url-maps describe web-map --global
gcloud compute url-maps add-path-matcher web-map \
--default-service web-backend \
--path-matcher-name app-matcher \
--new-hosts app.example.com \
--path-rules "/api/*=api-backend,/docs/*=docs-backend"
gcloud compute url-maps validate web-map --global
Result
Requests match the correct backend service and the 404 responses disappear.
Ad Slot
Replace with Google AdSense or partner placement when monetization is enabled.
Premium Slot
Reserve this space for premium runbooks, downloadable templates, or paid incident checklists.
