Skip to content

Return 404 for missing CSS assets instead of routing through CakePHP#425

Merged
ostefano merged 1 commit into
MISP:masterfrom
BytesUnlimited-net:fix/css_map_error
Jun 22, 2026
Merged

Return 404 for missing CSS assets instead of routing through CakePHP#425
ostefano merged 1 commit into
MISP:masterfrom
BytesUnlimited-net:fix/css_map_error

Conversation

@BytesUnlimited-net

@BytesUnlimited-net BytesUnlimited-net commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This change ensures that missing CSS assets are handled by Nginx instead of being forwarded to CakePHP.

Problem

The application was configured with:

location / {
    try_files $uri $uri/ /index.php$is_args$query_string;
}

When a CSS-related asset (for example, a .css.map file) did not exist under /css/, the request fell through to index.php and was interpreted by CakePHP as an application route.

In practice, this caused asset requests to be treated as navigational URLs, which could interfere with authentication redirect logic and result in invalid login redirection behavior.

Solution

Handle missing CSS asset requests at the web server level so they return a proper 404 Not Found response instead of being routed through CakePHP.

This is done by restricting /css/ to static file resolution only.

Impact

  • Missing CSS assets now return a correct 404 response
  • CSS asset requests no longer reach CakePHP
  • Prevents asset URLs from interfering with authentication redirect logic

@BytesUnlimited-net BytesUnlimited-net changed the title Return 404 for missing static assets instead of routing through CakePHP Return 404 for missing CSS assets instead of routing through CakePHP Jun 22, 2026
@ostefano ostefano self-assigned this Jun 22, 2026
@ostefano ostefano added the scheduled Will merge at the next opportunity label Jun 22, 2026
@ostefano ostefano merged commit 4c65a72 into MISP:master Jun 22, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scheduled Will merge at the next opportunity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants