Skip to content

sw-precache config incorrectly serves favicon.ico (with index.html) #2894

Closed
@Enselic

Description

@Enselic

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes

Which terms did you search for in User Guide?

I read https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#making-a-progressive-web-app

Environment

  1. node -v: v6.10.3
  2. npm -v: 4.6.1
  3. yarn --version (if you use Yarn): Not used
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: Linux SVP1321M2EB 4.4.0-53-generic Recursively copy the template folder #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  2. Browser and version (if relevant): Google Chrome Version 59.0.3071.86 (Official Build) (64-bit)

Steps to Reproduce

  1. create-react-app favicon-sw-repro
  2. cd favicon-sw-repro
  3. npm run build
  4. npm install -g serve
  5. serve -s build
  6. Go to http://localhost:5000/ in a browser that support service workers. I used Google Chrome
  7. Then go to http://localhost:5000/favicon.ico in the same browser

Expected Behavior

favicon.ico is served, either by the service-worker or by serve directly

Actual Behavior

index.html is served.
(If you Shift+F5 to bypass service-worker, the correct favicon.ico is served)

Reproducible Demo

This is not a MCVE (although the step-by-step above is) but if you want to see the issue live you can visit
https://sequencediagram.io/ (to install service worker) and then https://sequencediagram.io/favicon.ico

Other info

As far as I know, favicon.ico is not a special case in service workers i.e. a proper service worker should handle favicon.ico properly.

Btw, thanks for create-react-app, it is awesome!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions