Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Network Engineer practice bank has an additional 2,437 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
Your organization is migrating a legacy web application behind a global external Application Load Balancer (EXTERNAL_MANAGED). You must configure a global URL map to meet these requirements:
legacy.example.com to HTTPS on www.example.com, preserving the original path, query parameters, and HTTP request method (such as POST).www.example.com/api/v1/{region}/orders/{orderId}/{subpath} to orders-backend, rewriting the path to /orders/{orderId}/{region}/{subpath} (preserving query parameters) and changing the Host header to orders.internal.example.com.How should you configure the URL map?
This configuration attempts to attach both a redirect action (urlRedirect) and a backend routing action to the same routeRule, sets pathRedirect: /, and relies on prefixMatch with asterisks (*) to match variable path segments.
routeRule (or pathMatcher), urlRedirect cannot be combined with a routeAction or backend service. A matched rule must either return a 3xx redirect directly to the client or forward traffic to a backend service.pathRedirect: / replaces the entire incoming request path with /, discarding paths such as /catalog/item rather than preserving them.prefixMatch: In Application Load Balancer matchRules, prefixMatch treats * as a literal character rather than a wildcard. Consequently, /api/v1/*/orders/* will only match URLs containing literal * characters and will never match /api/v1/us/orders/123/items.urlRedirect: To keep the requested path intact during a host or HTTPS redirect, both pathRedirect and prefixRedirect must be omitted from the redirect block.routeRules requires pathTemplateMatch (using *, **, or {name}) or regexMatch (using RE2 syntax).Location header back to the client (3xx), whereas rewrites modify the request silently in transit to a backend.The legacy redirect used a dedicated pathMatcher without a routeAction or service, omitted pathRedirect to preserve the path, and used pathTemplateMatch or regexMatch (alongside regexRewrite.pathPattern) instead of prefixMatch.
This configuration uses separate hostRules and pathMatchers in a global URL map to isolate canonical URL enforcement (urlRedirect) from in-flight request transformation (urlRewrite) before forwarding requests to orders-backend.
hostRules for legacy.example.com map to a pathMatcher using defaultUrlRedirect. Setting httpsRedirect: true and hostRedirect: www.example.com while omitting pathRedirect and prefixRedirect preserves the original request path. Setting stripQuery: false retains all query parameters, and PERMANENT_REDIRECT (HTTP 308) guarantees that clients preserve the HTTP request method (such as POST).hostRules for www.example.com map to a pathMatcher with routeRules. pathTemplateMatch captures single path segments ({region}, {orderId}) and trailing multi-segment paths ({subpath=**}). pathTemplateRewrite reorders those exact variables into /orders/{orderId}/{region}/{subpath} while automatically splitting off and re-appending query parameters.hostRewrite: orders.internal.example.com updates the Host header before the load balancer forwards the request to orders-backend.urlRewrite executes, backends can still inspect the original client URL in the x-client-request-url and x-envoy-original-path headers.pathTemplateRewrite automatically preserves query strings without manual regex handling.Separating legacy.example.com and www.example.com into distinct pathMatchers ensures clean rule isolation, uses HTTP 308 for method-safe permanent canonicalization, and leverages path template matching and rewriting—which is purpose-built for reordering captured URL segments without complex regular expressions.
This approach uses a URL map with defaultUrlRedirect returning an HTTP 301 (MOVED_PERMANENTLY_DEFAULT) status code for the legacy domain while attempting to combine pathRules, routeRules, pathPrefixRewrite, and headerAction inside a single pathMatcher to handle API traffic.
MOVED_PERMANENTLY_DEFAULT (HTTP 301) allows user agents and HTTP clients to downgrade POST requests to GET when following the redirect, violating the requirement to retain the HTTP request method.pathRules and routeRules are mutually exclusive and cannot both appear inside the same pathMatcher. In addition, mixing legacy.example.com and www.example.com in the same pathMatcher prevents isolating the legacy redirect behavior from the canonical domain's routing.pathPrefixRewrite only substitutes a static leading prefix matched by prefixMatch; it cannot capture dynamic variables such as {region} and {orderId} and reorder them in the rewritten path.MOVED_PERMANENTLY_DEFAULT is widely used for standard browser GET redirects, but only PERMANENT_REDIRECT (HTTP 308) and TEMPORARY_REDIRECT (HTTP 307) explicitly mandate retaining the original HTTP request method.urlRewrite.hostRewrite rather than manipulating arbitrary headers with headerAction.pathMatcher must use either simple pathRules (longest-path-matches-first) or advanced routeRules (priority-ordered).Only GET requests needed permanent redirection, the API rewrite only required replacing a static leading prefix rather than reordering path segments, and routeRules were used exclusively in a dedicated pathMatcher for www.example.com.
This configuration applies defaultUrlRedirect with TEMPORARY_REDIRECT (HTTP 307) and stripQuery: true for the legacy hostname, while pairing pathTemplateMatch variables with regexRewrite.pathSubstitution on the canonical hostname.
stripQuery: true removes everything after the ? in the URL during redirection, directly violating the requirement to preserve query parameters.TEMPORARY_REDIRECT (HTTP 307) retains the HTTP request method, it signals a temporary move rather than a permanent canonical migration, preventing permanent caching and search-engine canonicalization.regexRewrite.pathSubstitution uses RE2 regular expression capture groups (such as (?<orderId>...) defined in regexRewrite.pathPattern), not variables captured by pathTemplateMatch. Using \g<orderId> without a matching pathPattern capture group will not substitute pathTemplateMatch variables.routeRules support either pathTemplateMatch paired with pathTemplateRewrite (using {variable} syntax) or RE2 regexRewrite paired with pathPattern and pathSubstitution (using \g<name> or \1 syntax).stripQuery defaults to false when omitted; explicitly setting it to true discards all query strings on the Location header.307 is intended for short-lived transitions while 308 (PERMANENT_REDIRECT) enforces permanent canonical URLs.The migration were temporary, query strings needed to be discarded on redirect, and the rewrite used either pathTemplateRewrite with pathTemplateMatch or defined RE2 named capture groups inside regexRewrite.pathPattern.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated