Chapter 7. Debugging CORS requests

 

This chapter covers

  • Using network sniffers like Wireshark to view network traffic
  • Using curl to make an HTTP request
  • Debugging requests from mobile devices
  • Getting more help on CORS-related questions

Suppose that, using the guidance from the previous chapters, you now have a working CORS server with a web page that makes CORS requests. You fire up your server, visit your web page...and nothing happens. Now what?

Up until this point, we’ve focused on how to build a working CORS server implementation. But what happens when things go wrong? Over the course of developing any application, things inevitably go wrong and need to be debugged. You may be building a CORS server, and find that requests aren’t going through. Or you may be coding a client that talks to a CORS server, and find that the request is failing. Either way, you need to know how to figure out what is going wrong.

This chapter introduces tools that can be used to debug CORS requests. It starts by introducing features of the Chrome Debugger Tool. Next it looks at how to monitor request and response headers using Wireshark. Then it turns to using curl and test-cors.org to make CORS requests. It ends with resources where you can find answers to your CORS questions.

7.1. Solving CORS errors

7.2. Using the browser’s developer tools

7.3. Monitoring network traffic

7.4. Using curl to simulate CORS requests

7.5. Sending requests using test-cors.org

7.6. Tips for mobile debugging

7.7. Getting help

7.8. Summary

sitemap