A URL map is a configuration that directs incoming web traffic to different backend services based on the URL path or host. It helps route users to the right place.
Click to reveal answer
beginner
How does a URL map decide where to send a request?
It checks the URL's host and path against rules you set. When it finds a match, it sends the request to the backend service linked to that rule.
Click to reveal answer
intermediate
What is a host rule in a URL map?
A host rule matches the domain name part of a URL (like example.com) and connects it to path matchers that further decide routing based on URL paths.
Click to reveal answer
intermediate
Why use path matchers in URL maps?
Path matchers let you send different URL paths (like /images or /videos) to different backend services, helping organize traffic efficiently.
Click to reveal answer
beginner
What happens if no URL map rule matches a request?
The request is sent to the default backend service defined in the URL map, ensuring traffic is always handled even if no specific rule matches.
Click to reveal answer
What does a URL map primarily control in GCP?
AStorage of website files
BRouting of incoming web requests to backend services
CUser authentication
DDatabase connections
✗ Incorrect
URL maps control how incoming web requests are routed to backend services based on URL patterns.
Which part of the URL does a host rule in a URL map match?
AThe domain name (host)
BThe URL path
CThe query parameters
DThe HTTP headers
✗ Incorrect
Host rules match the domain name part of the URL to decide routing.
If a URL path is '/images', where does the URL map send the request?
ATo the database
BTo the default backend service only
CTo the firewall
DTo the backend service linked to the '/images' path matcher
✗ Incorrect
Path matchers route requests based on URL paths like '/images' to specific backend services.
What happens if no host or path rule matches a request in a URL map?
AThe request goes to the default backend service
BThe request is dropped
CThe request is sent to a random backend
DThe request is redirected to the homepage
✗ Incorrect
Requests with no matching rules are sent to the default backend service to ensure handling.
Which GCP service commonly uses URL maps for routing?
ACloud Functions
BCloud Storage
CCloud Load Balancing
DBigQuery
✗ Incorrect
Cloud Load Balancing uses URL maps to route traffic to backend services.
Explain how URL maps route traffic in Google Cloud Platform.
Think about how a traffic director sends cars to different roads based on signs.
You got /4 concepts.
Describe the role of host rules and path matchers in URL maps.
Host rules are like street names, path matchers are like house numbers.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a URL map in Google Cloud Platform's load balancing?
easy
A. To store user data for web applications
B. To create virtual machines automatically
C. To route incoming web traffic to different backend services based on URL paths or hosts
D. To monitor network traffic usage
Solution
Step 1: Understand URL map role
A URL map directs web traffic to backend services depending on URL patterns.
Step 2: Identify correct function
Routing based on URL paths or hosts matches the description of URL maps.
Final Answer:
To route incoming web traffic to different backend services based on URL paths or hosts -> Option C
Quick Check:
URL maps route traffic = B [OK]
Hint: URL maps decide backend by URL pattern [OK]
Common Mistakes:
Confusing URL maps with storage or VM services
Thinking URL maps monitor traffic instead of routing
Assuming URL maps create resources automatically
2. Which of the following is the correct syntax to define a path matcher in a GCP URL map configuration?
easy
A. "pathMatcher": {"name": "pm1", "defaultService": "backend1"}
B. "pathMatchers": [{"name": "pm1", "defaultService": "backend1"}]
C. "pathMatchers": {"name": "pm1", "defaultService": "backend1"}
D. "pathMatcher": [{"name": "pm1", "defaultService": "backend1"}]
Solution
Step 1: Identify correct key for multiple path matchers
The key for multiple path matchers is plural: "pathMatchers" with an array value.
Step 2: Confirm value type
The value must be an array of objects, so square brackets [] are needed.
Final Answer:
"pathMatchers": [{"name": "pm1", "defaultService": "backend1"}] -> Option B
Quick Check:
Multiple path matchers use "pathMatchers" array = A [OK]
Hint: Use plural "pathMatchers" with array brackets [OK]
Common Mistakes:
Using singular "pathMatcher" for multiple entries
Using object instead of array for pathMatchers
Mixing singular/plural keys incorrectly
3. Given this URL map snippet, which backend service will handle the request to https://example.com/images/logo.png?
Believing backend service must be explicitly defined to route
5. You want to route requests to https://example.com/api/v1/users to backend-v1 and requests to https://example.com/api/v2/users to backend-v2. Which URL map configuration correctly achieves this?