Practice Exam

Question 23 of 75

Resolve API Access Error

You work as an API Developer for MDFT Pro, a well-known training agency that delivers cloud certification courses to students worldwide. Mark, the Full Stack Development Lead, has developed and deployed a Java RESTful API to Azure App Service that provides course catalog information, student enrollment data, and quiz results.

The API is designed to be consumed by the student web portal (running at localhost:6000 during development) and will eventually be accessed by the production web application at portal.mdftpro.com. During testing, when you open a browser and navigate to the API endpoint at api-mdftpro.azurewebsites.net/api/Courses, you receive the following error message:

Failed to load api-mdftpro.azurewebsites.net/api/Courses: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ’localhost:6000’ is therefore not allowed access.

The web portal needs to successfully call the API to display course information to students. What should you do to resolve this error and allow the web portal to access the API?

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about CORS in App Service:
Configure CORS
Next Question
Discuss this question on social media: