question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot serve built static assets from external CDN

See original GitHub issue

Description

We have a SPA served from an AWS server (e.g. “https://s3.eu-central-1.amazonaws.com/...”) but used on our domain (e.g. https://www.mydomain.com/...); we have some .svg files bundled within and our package.jsonhomepage” is set to the AWS url.

The .js and .css assets are retrieved correctly from AWS, but the browser tries to retrieve the .svg files from our domain, and of course it fails since they are hosted on the AWS server.

Expected behavior

Assets built in build/static/media/* are resolved from the domain specified in the package.jsonhomepage” value (i.e. “https://s3.eu-central-1.amazonaws.com/...”).

Actual behavior

Static assets are resolved from the domain where the main.[hash].js is being loaded from (i.e. “https://www.mydomain.com/...”).

Environment

  • npm ls react-scripts: react-scripts@0.6.1
  • node -v: v6.8.0
  • npm -v: 3.10.8
  • Operating system: any OS
  • Browser and version: any browser

Reproducible Demo

Basic CRA setup with external files imported.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
Timercommented, Feb 10, 2017

Resolved in #937 and #1504.

1reaction
Timercommented, Feb 11, 2017

Hi @EnoahNetzach! This is out in 0.9.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load local static files if CDN fails? (django)
Only use local servers for serving those static files, distribute the load with application servers that each have their own versioned copies of ......
Read more >
How to manage static files (e.g. images, JavaScript, CSS)
This page describes how you can serve these static files. ... In your templates, use the static template tag to build the URL...
Read more >
External storage for static objects - GitLab Docs
Configure GitLab to serve repository static objects (such as archives or raw blobs) from external storage such as a content delivery network (CDN)....
Read more >
Static files in ASP.NET Core | Microsoft Learn
Static files, such as HTML, CSS, images, and JavaScript, are assets an ASP.NET Core app serves directly to clients by default.
Read more >
Static Assets — The Pyramid Web Framework v2.0
add_static_view () cannot serve a single file, nor can it serve a ... to an external URL in production when our assets are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found