CORS preflight channel did not succeed. Only in Firefox. Chrome works fine

CORS preflight channel did not succeed. Only in Firefox. Chrome works fine

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

CORS Preflight Failure in Firefox: A Case Study in Browser Quirks and CakePHP Routing

When a cross-origin request fails specifically in Firefox while Chrome works perfectly, the issue often isn't a browser bug but a subtle divergence in how browsers interpret or enforce CORS policies during the preflight phase. The error CORS preflight channel did not succeed indicates that the OPTIONS request returned by your server was either rejected by the browser's security checks or failed to provide the necessary headers before the actual data request could proceed.

In the scenario described, an Angular 4 application attempts to fetch data from a CakePHP backend. The frontend makes a POST request to http://localhost:8080/api/cross-series/network-series. Upon inspecting the server logs, a critical discrepancy emerges: Firefox logs show the action as options, whereas Chrome logs show getNetworkSeries. This difference is the smoking gun.

The OPTIONS Trap in CakePHP

The root cause lies in how CakePHP handles routing and action execution relative to the Access-Control-Allow-Origin header. In your provided PHP code, you are setting headers manually:

$this->response->header('Access-Control-Allow-Origin', 'http://localhost:4200');
$this->response->header('Access-Control-Allow-Credentials', 'true');
// ... other headers
array_push($this->allowedActions, 'options');

While setting Access-Control-Allow-Origin is standard, the logic for handling the options action needs scrutiny. If your controller method named options() or the routing logic expects a specific action name to trigger CORS headers, but the browser sends a raw OPTIONS request, CakePHP might be attempting to resolve this as a standard route before you have a chance to intercept it with your custom header logic, or vice versa.

However, the most likely culprit in this specific setup is the missing Vary: Origin header. Modern browsers, particularly Firefox, are strict about caching CORS responses. If your server returns Access-Control-Allow-Origin: http://localhost:4200 without a Vary: Origin header, the browser may cache that response for all subsequent requests from different origins (or even the same origin if caching rules are misinterpreted), leading to immediate blockage on reloads or specific navigation paths.

Routing Discrepancies and Case Sensitivity

A more fundamental issue revealed in your update involves the controller name resolution. Your URL is /api/cross-series/network-series, but your route definition maps this to the Series controller with the action getNetworkSeries.

Router::connect('/cross-series/network-series', array(
    'controller' => 'Series',
    'action' => 'getNetworkSeries',
    '[method]' => 'POST',
    'ext' => 'json',
));

Firefox logs indicate it is trying to route to Cross-seriesController. This suggests that when the browser sends the OPTIONS request, your application is perhaps routing based on a different logic or interpreting the path differently than Chrome does.

In CakePHP, routes are case-sensitive regarding controller names if the URL casing doesn't match exactly what the router expects, though usually, they normalize this. However, if you have an options() method in your SeriesController that handles CORS, ensure that the routing configuration explicitly allows the OPTIONS method for that specific path without trying to map it to a non-existent controller class named after the URL segment.

The error [MissingControllerException] Controller class Cross-seriesController could not be found confirms that somewhere in the request lifecycle, the system is looking for a controller literally named Cross-seriesController. This often happens if the router interprets slashes or hyphens in the URL path as namespace separators or part of a plugin name, rather than just route segments.

Debugging Strategy

To resolve this, focus on these steps:

  1. Add the Vary Header: Update your CORS middleware or controller logic to always include Vary: Origin. This tells the browser not to cache the CORS response for other origins.
    $this->response->header('Vary', 'Origin');
    
  2. Inspect the Routing Table: Ensure that the route /cross-series/network-series is defined in Router.php before any potential wildcard routes or plugin routes that might be attempting to parse Cross-series as a class name.
  3. Verify Action Names: Check if your SeriesController has an options() method. If you are relying on the default CakePHP behavior, ensure that the OPTIONS request is being handled by the framework's built-in CORS logic or your custom headers are applied before any view rendering or action execution that might throw exceptions.
  4. Check for Plugin Interference: Since the error mentions a missing controller, ensure no plugins are attempting to auto-map routes based on URL segments that contain hyphens, which can be interpreted as namespaced class paths in some configurations.

By aligning the routing logic to correctly identify the Series controller regardless of how the browser sends the OPTIONS preflight, and ensuring proper header caching policies, you can eliminate this Firefox-specific failure. The upgrade from Angular 2 to 5 likely changed the timing or structure of the preflight request headers (such as adding more specific headers), triggering a stricter interpretation of your server's response that was previously tolerated by Chrome but rejected by Firefox.

Our network