Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your API Works in cURL. Why Does the Browser Reject It?

The API returns JSON in your terminal. Your frontend gets a network error. Before changing the payload again, compare the two requests: the browser may be asking permission to send a request that cURL sends directly. That difference gives you a useful starting point. Keep the successful request as a baseline, then investigate the browser exchange separately. Find the request that actually failed…

The issue described in the report revolves around an API working correctly when accessed via cURL but failing in a browser due to Cross-Origin Resource Sharing (CORS) restrictions. The discrepancy arises because cURL sends requests directly, bypassing browser security protocols like CORS. To troubleshoot this, one should compare the requests made by cURL and the browser, with a focus on the preflight request (OPTIONS) that browsers send to check if the actual request is allowed.

This involves using tools like the browser's Network panel to reproduce the failure and inspect headers. If the preflight fails, the intended request may never reach the server handler. The report suggests creating a small incident note capturing the page origin, destination URL, intended method, requested headers, and the first failing status, as well as determining which layer (application, gateway, or reverse proxy) produced the failure.

Additionally, it's important to test the actual response after a successful preflight, as the response needs to include appropriate CORS headers. When dealing with cookie-based cross-origin requests, ensure the server allows credentials and returns the specific allowed origin, as browser cookie policies still apply. The report also advises against switching to the "no-cors" mode, as it produces an opaque response that cannot be read by the code.

A concise reproduction package containing the working request, preflight probe, and browser failure details should be kept for future reference.

Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Your Custom ESP32 Board Probably Fails on the PCB, Not in the Firmware

The first custom ESP32 board most people make works on the bench and misbehaves everywhere else. The Wi-Fi range is half what the dev board had. The chip resets the moment it tries to connect.

  • 80% of ESP32 board failures result from PCB layout issues, not firmware problems
  • Incorrect strapping pin configuration and USB-C power issues are additional frequent failure causes

"iPhone storage full" but your photos are in iCloud? What's actually going on

It's one of the most confusing iPhone messages: you turned on iCloud Photos, you pay for 200 GB or 2 TB, and your phone still says storage almost full .

  • iPhone storage appears full despite iCloud photos enabled
  • Optimize iPhone Storage keeps full-resolution photos in iCloud
  • SnapClean identifies local storage issues and compresses files

I analyzed [12,347] love letters without opening a single one

I run two letter sites. Digital Letter , where you pick a design, write a note, seal it in a digital envelope, and send it with a link.

  • Author analyzed 12,347 sealed letters and 3,812 open-when envelopes
  • Median letter contains 89 words, with emojis averaging 5.1 per letter
  • Open-when letters often express difficult emotions like apologies

More from Friday 9 October →