Skip to content

Service worker breaks direct link to static assets in public folder #3664

Closed
@James2516

Description

@James2516

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?

service worker

Environment

  1. node -v: v8.6.0
  2. npm -v:
  3. yarn --version (if you use Yarn): 1.3.2
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: Mac
  2. Browser and version (if relevant): Chrome v63

Steps to Reproduce

https://redirect.netlify.com/
The first link works, but not the second. Why?

import React from "react";

const App = () => (
  <div>
    <p>
      <a href="http://redirect.netlify.com/manifest.json">
        http://redirect.netlify.com/manifest.json
      </a>
    </p>
    <p>
      <a href="https://redirect.netlify.com/manifest.json">
        https://redirect.netlify.com/manifest.json
      </a>
    </p>
  </div>
);

export default App;

Service worker code: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/src/registerServiceWorker.js

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