Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserSync client script not cached #657

Closed
maoueh opened this issue Jun 5, 2015 · 3 comments · May be fixed by tobybellwood/govstrap#4
Closed

BrowserSync client script not cached #657

maoueh opened this issue Jun 5, 2015 · 3 comments · May be fixed by tobybellwood/govstrap#4

Comments

@maoueh
Copy link

maoueh commented Jun 5, 2015

Hi there,

It seems that the browser-sync client javascript that is served to the browser has no caching headers in the HTTP response leading the browser to not cache it upon new requests to the file.

I'm wondering why because other files served through browser sync correctly have the caching headers (specially the Cache-Control and Etag ones). I am missing something obvious here?

Here the steps to replicate (I could create a small repo if you prefer):

$ mkdir /tmp/browser-sync-client && cd /tmp/browser-sync-client
$ echo "<html>Browser Sync Caching Test</html>" > index.html
$ browser-sync start --server &
$ # You can also check in browser developer tools
$ curl -v http://localhost:3000 2>&1 | grep "Cache\|ETag" # Correct, has caching headers
$ curl -v http://localhost:3000/browser-sync/browser-sync-client.2.7.6.js 2>&1 | grep "Cache-Control\|ETag" # Incorrect, no caching headers

I'm willing to tackle this issue if you aim me in the right direction.

Regards,
Matt

@shakyShane
Copy link
Contributor

@maoueh we'd love to receive a contribution from you!

so it's actually an issue in the browser-sync-client library...

Browsersync retrieves the middleware via a plugin manager and then registers it with the connect middleware stack. (it does the same thing for the proxy/snippet servers too)

so basically, you can add headers to the client library here

Hope that helps

@maoueh
Copy link
Author

maoueh commented Jun 8, 2015

@shakyShane Excellent, thanks for the information, that's all I needed. I will take a look at it this week. Will ping you back if I need further help.

Regards,
Matt

@maoueh
Copy link
Author

maoueh commented Jun 9, 2015

@shakyShane Let's move discussion to the WIP PR. You're early comments are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants