Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 129 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 129
Topic #: 1
[All Professional Cloud Developer Questions]

You have an application that uses an HTTP Cloud Function to process user activity from both desktop browser and mobile application clients. This function will serve as the endpoint for all metric submissions using HTTP POST.
Due to legacy restrictions, the function must be mapped to a domain that is separate from the domain requested by users on web or mobile sessions. The domain for the Cloud Function is https://fn.example.com. Desktop and mobile clients use the domain https://www.example.com. You need to add a header to the function's
HTTP response so that only those browser and mobile sessions can submit metrics to the Cloud Function. Which response header should you add?

  • A. Access-Control-Allow-Origin: *
  • B. Access-Control-Allow-Origin: https://*.example.com
  • C. Access-Control-Allow-Origin: https://fn.example.com
  • D. Access-Control-Allow-origin: https://www.example.com
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
thewalker
4 months ago
Selected Answer: D
The correct answer is D. Access-Control-Allow-origin: https://www.example.com . Here's why: CORS (Cross-Origin Resource Sharing): The scenario you've described involves a classic CORS issue. Your Cloud Function (on https://fn.example.com ) is being accessed from a different origin ( https://www.example.com ). Browsers have security restrictions that prevent requests from one domain to another without explicit permission. Access-Control-Allow-Origin Header: This header is used to tell the browser which origins are allowed to make requests to your Cloud Function.
upvoted 1 times
...
__rajan__
1 year, 2 months ago
Selected Answer: D
D is correct.
upvoted 1 times
...
purushi
1 year, 3 months ago
Selected Answer: D
It is like requesting service from front end to back-end service. Here front-end service domain is https://www.example.com and back-end service domain where cloud function runs is https://fn.example.com
upvoted 1 times
...
Pime13
1 year, 9 months ago
Selected Answer: D
vote d
upvoted 2 times
...
zellck
1 year, 11 months ago
Selected Answer: D
D is the answer. https://cloud.google.com/functions/docs/samples/functions-http-cors
upvoted 1 times
...
tomato123
2 years, 3 months ago
Selected Answer: D
D is correct
upvoted 2 times
...
htakami
2 years, 8 months ago
I agree with D but just a little detail (idk if it was a typo) ... the word "origin" must be "Origin"... besides that seems correct
upvoted 4 times
...
GCPCloudArchitectUser
2 years, 9 months ago
Selected Answer: D
I agree it should be D
upvoted 4 times
...
Blueocean
2 years, 10 months ago
Should be Option D, Option A will allow all and not only specific as requested in the question
upvoted 3 times
...
scaenruy
2 years, 10 months ago
I vote D
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...