What method can you use to securely allow your HTTP Cloud Function to accept requests exclusively from specific domains?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Google Cloud Professional Cloud Developer Test. Benefit from mock assessments featuring flashcards and multiple-choice format, each furnished with hints and detailed explanations. Excel in your exam with confidence!

Implementing CORS (Cross-Origin Resource Sharing) is the correct approach for securely allowing your HTTP Cloud Function to accept requests exclusively from specific domains. CORS is a protocol that defines a way for web browsers to allow or deny access to resources on a web server based on the originating domain of a request. By configuring CORS in your Cloud Function, you can specify which domains are permitted to interact with your function, thereby adding a layer of security by preventing unauthorized domains from making requests.

When you set up CORS, you configure the response headers to include the Access-Control-Allow-Origin header with the allowed domain(s). This way, when the browser of a client application makes a request to your function, the browser checks the CORS headers. If the originating domain isn’t allowed, the browser will block the request, effectively preventing unwanted access to your function.

Other methods, while potentially useful in different contexts, do not specifically address the need to restrict access based on the originating domain in a straightforward manner. For instance, whitelisting specific origin domains in the function's settings may not be a built-in functionality; using API keys can help manage and control access but does not inherently restrict requests based on the domain. Limiting access by service accounts

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy