Client repeatedly gets css using local server

I made a basic app and added cakedc user. When loading the client calls for the css continually :

[Wed Jan 4 00:20:33 2023] [::1]:55073 [200]: GET /css/normalize.min.css
[Wed Jan 4 00:20:33 2023] [::1]:55075 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55074 [200]: GET /css/milligram.min.css
[Wed Jan 4 00:20:33 2023] [::1]:55075 [200]: GET /css/cake.css
[Wed Jan 4 00:20:33 2023] [::1]:55073 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55074 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55075 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55076 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55077 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55076 [200]: GET /css/normalize.min.css
[Wed Jan 4 00:20:33 2023] [::1]:55077 [200]: GET /css/milligram.min.css
[Wed Jan 4 00:20:33 2023] [::1]:55076 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55077 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55078 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55078 [200]: GET /css/cake.css
[Wed Jan 4 00:20:33 2023] [::1]:55078 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55079 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55079 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55080 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55080 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55081 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55081 Closing
[Wed Jan 4 00:20:33 2023] [::1]:55082 Accepted
[Wed Jan 4 00:20:33 2023] [::1]:55082 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55083 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55084 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55085 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55083 [200]: GET /css/normalize.min.css
[Wed Jan 4 00:20:34 2023] [::1]:55084 [200]: GET /css/milligram.min.css
[Wed Jan 4 00:20:34 2023] [::1]:55085 [200]: GET /css/cake.css
[Wed Jan 4 00:20:34 2023] [::1]:55083 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55084 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55085 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55086 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55086 [200]: GET /css/normalize.min.css
[Wed Jan 4 00:20:34 2023] [::1]:55086 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55087 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55087 [200]: GET /css/milligram.min.css
[Wed Jan 4 00:20:34 2023] [::1]:55087 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55088 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55088 [200]: GET /css/cake.css
[Wed Jan 4 00:20:34 2023] [::1]:55088 Closing
[Wed Jan 4 00:20:34 2023] [::1]:55089 Accepted
[Wed Jan 4 00:20:34 2023] [::1]:55089 Closing

(this continues even when the page appears to be loaded).

This is related to cakedc user as I’ve never saw this on other test apps I’ve made with out Cakedc user. However I cannot find anyone with a similar issue on their github page. I’m curious if there is something else I’m doing wrong that only manifests itself when using cakedc user.

I’ve verified the urls it repeatedly loads do exist and load.

Any help is appreciated!

Static assets should be served directly via the webserver and not go through PHP (and therefore CakePHP). So first make sure your webservers config is setup so the docroot is set to the webroot folder of your cakephp app.

No idea what causes this problem for you. Without a way to reproduce this we can’t really help you here.

might be an issue with the client-side caching of these CSS files, causing the client to repeatedly request them. You can try adding cache-control headers to the server’s response to the CSS file requests to see if that resolves the issue.

Alternatively, there could be a problem with the client-side code that is causing it to continually request the CSS files. In this case, you might want to review the client-side code to see if you can identify the issue.

Thanks all for your input.

After running through a bit more of the CakeDC/Users tutorial the problems goes away. So this is no longer a problem but I’m still interested in what was happening (just for knowledge sake). To clarify, serving via bin/cake server, the client never ends it’s request. It keep asking for the files continually. Not just a lack of caching between requests. If I request the homepage the requests for above will just keep coming in until I close the tab. Strange.

That is something you have to debug through your browsers network tab.
Each request has a Initiator tab which you can look at to see if it was triggered by HTML, JS or something else.

1 Like