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

failed to proxy simple files #3841

Open
juanca opened this issue Apr 7, 2023 · 0 comments
Open

failed to proxy simple files #3841

juanca opened this issue Apr 7, 2023 · 0 comments

Comments

@juanca
Copy link

juanca commented Apr 7, 2023

I am having trouble configuring Karma to proxy requests to particular files on the file system. IIRC, this used to work a few years ago but some Karma upgrade probably broke these. I have enabled debug level logging but it does not say much in the output.

This happens for a variety of files but here is my most recent issue:

files: [
  {
    pattern: 'node_modules/msw/lib/mockServiceWorker.js',
    included: false,
    served: true,
  },
],
proxies: {
  '/mockServiceWorker.js': '/base/node_modules/msw/lib/mockServiceWorker.js',
},

Loading up http://localhost:9876/base/node_modules/msw/lib/mockServiceWorker.js works great. But the actual proxy http://localhost:9876/mockServiceWorker.js does not work and gives the following output (with debug level):

06 04 2023 18:18:14.605:DEBUG [middleware:source-files]: Requesting /mockServiceWorker.js
06 04 2023 18:18:14.605:DEBUG [middleware:source-files]: Fetching /mockServiceWorker.js
06 04 2023 18:18:14.605:DEBUG [proxy]: proxying request - /mockServiceWorker.js to localhost:9876
06 04 2023 18:18:14.611:WARN [proxy]: failed to proxy /base/node_modules/msw/lib/mockServiceWorker.js (connect ECONNREFUSED ::1:9876)

Is there a specific proxy configuration to use for files?

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

No branches or pull requests

1 participant