statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.06k stars 531 forks source link

404 error on direct links to Asset entries #11091

Open RyanDrewniak opened 10 hours ago

RyanDrewniak commented 10 hours ago

Bug description

If I navigate to the asset browser in the CP and click on an entry in the list, it loads the modal with the target edit URL with no problems. However, when trying to link directly to an asset in the CP like this (i.e. either linking directly to this URL or loading that exact URL in a browser window):

https://my-site-url.com/cp/assets/browse/assets/1dsc09534.jpg/edit

it throws a basic nginx 404 error. The site in question is running php 8.2 on an nginx server.

How to reproduce

  1. Select an asset from the assets section of the admin panel, loading the "edit" url.
  2. Copy that url targeting that specific asset and open it in a new browser tab.

Logs

No response

Environment

Environment
Application Name: TestSite
Laravel Version: 10.48.22
PHP Version: 8.2.24
Composer Version: 2.2.6
Environment: development
Debug Mode: ENABLED
URL: testsite.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, slack
Mail: mailgun
Queue: sync
Session: redis

Livewire
Livewire: v3.5.12

Sentry
Enabled: YES
Environment: development
Laravel SDK Version: 4.9.0
PHP SDK Version: 4.9.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 7
Sites: 5 (Main, Edmonton - Kids, Calgary - Kids, Edmonton - Adult, Calgary - Adult)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.33.1 PRO

Statamic Addons
alt-design/alt-redirect: 1.3.2
jacksleight/statamic-bard-mutator: 3.0.3
jacksleight/statamic-bard-texstyle: 3.3.1
mitydigital/sitemapamic: 3.2.0
statamic/eloquent-driver: 4.15.2
stillat/antlers-components: 2.2.0
teamnovu/statamic-unused-assets: 2.0.2

Statamic Eloquent Driver
Asset Containers: file
Assets: file
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: file

Installation

Starter Kit using via CLI

Additional details

No response

jasonvarga commented 9 hours ago

~Looks like maybe a duplicate of #11089.~

Can your show your nginx config?

RyanDrewniak commented 6 hours ago

Based on the previously linked issue chain, this is the most plausible part of my nginx config that might be causing problems:

# Directives to send expires headers and turn off 404 error logging.
location ~* ^(?!img\/).*\.(?:ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf) {
        access_log off;
        log_not_found off;
        expires max;

        add_header Pragma public;
        add_header Cache-Control "public, max-age=86400";
        add_header X-Asset "yes";
}

# Static assets. Caching for assets that we need to update more consistently
location ~* \.(css|js|woff|ttf|otf|woff2|eot)$ {
        expires 30d;
        access_log off;
        add_header Pragma public;
        add_header Cache-Control "public, max-age=86400";
        add_header X-Asset "yes";
}

Outside of that, in my assets.php statamic config file, I have it set with: route => 'glide-images'.