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.

default webpack proxy blocks file downloads

See original GitHub issue

problem

  • when using the proxy field in package.json, e.g. "proxy": "http://localhost:9090", <a href='...' download>download</a>'s will fail because:

The development server will only attempt to send requests without text/html in its Accept header to the proxy.

…which the browser adds when using a:href:download nodes. this means that users cannot interact with HTML5 file downloads when using a simple proxy configuration.

discussion

  • i would suggest that the behavior attempt to access the proxy iff the pathname !== pathname(homepage || '/')
    • on 4xx, send the root index HTML, per current behavior

im just thinking out loud here. would love critique/inputs.

i did (after writing this) try the "configure it on your own " method:

  "proxy": {
    "/api": {
      "target": "http://localhost:9090",
      "ws": true
    },
    "/graphql": {
      "target": "http://localhost:9090",
      "ws": true
    }
  }

and it all worked 🍑y.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cdaringecommented, Nov 2, 2018

go away stale bot! this is one we should definitely consider!

0reactions
Timercommented, Nov 2, 2018

It’d be hard to get this right without breaking most existing users use case. The advanced proxy is probably the best route.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Asset Modules - webpack
By default, data URI emitted by webpack represents file contents encoded by using Base64 algorithm. If you want to use a custom encoding...
Read more >
Default proxy setting for create-react-app doesn't handle file ...
json . I have some api calls that are supposed to return .xls file downloads. But can't seem to be get it through...
Read more >
Why you should use a proxy server with Create React App
There are two common approaches of setting up proxy servers in React applications developed using CRA. We have the default CRA proxy option ......
Read more >
Webpack and Dynamic Imports: Doing it Right - Medium
The problem is if you want to dynamically load a file, in this case, an image, Webpack by default generate a chunk for...
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
A possible reason for this is that you have antivirus, browser extensions, proxies, or ad blocking software that may be modifying the file...
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