307 Redirect on Plugin Asset URLs

The first few times when I try to access a Plugin Asset URL, I get an endless 307 Redirect. Safari, for example, complains that there were too many redirects and fails to load the file.

Eventually, the file is generated (in my public/media/plugins folder) and will load correctly.

It’s hard for me to know if this is a Kirby issue, or maybe some Nginx configuration error.

Any suggestions?

Example Request:

GET [server] /media/plugins/test/test-plugin/vendor/somefile.js

Response:

HTTP/1.1 307 Temporary Redirect

X-Content-Type-Options: nosniff
Content-Type: text/html; charset=UTF-8
Server: nginx
Location: [server]/media/plugins/test/test-plugin/vendor/somefile.js
Transfer-Encoding: Identity
Date: Tue, 12 Feb 2019 23:35:15 GMT
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Connection: keep-alive

I’m also not convinced I’m importing in JS/CSS from plugins.

This is what I’m currently doing:

<?= js([
    'media/plugins/test/test-plugin/vendor/somefile.js',
    ], true) ?>

But with stuff like mediaUrl() and PluginAssets::index(), I assume there’s a better way.

@neildaniels Did you ever sort this out?

Not sure. I mostly stayed away from using plugin assets a while ago to avoid this altogether.