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.

V2, Config proxy not working

See original GitHub issue

I add proxy: { "/api": { "target": "http://jsonplaceholder.typicode.com/", "changeOrigin": true, "pathRewrite": { "^/api" : "" } } }, to config.js but not working.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

4reactions
yoagecommented, Sep 7, 2018

@TranDucBlog hello,it’s work. this is my configure added into /config/config.js

 proxy: {
    '/api': {
      target: 'http://api.car.local/',
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    }
  }

service api /src/services/api.js

export async function fakeAccountLogin(params) {
  return request('/api/wechat/member/sign-in', {
    method: 'POST',
    body: params,
  });

the origin API “http://api.car.local/wechat/member/sign-in

and then run without mock

npm run start:no-mock
4reactions
mailbaoercommented, Sep 7, 2018

@TranDucBlog try start npm without mock

npm run start:no-mock
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxy configuration did not working with angular CLI
my backend is hosted at localhost:8080/api thats why i am using proxy setting, and localhost:8080/api/getusers working fine. – DanzerZoneJS. Feb ...
Read more >
HTTPS proxy configuration not working
Problem. The infrastructure agent's HTTP/HTTPS proxy configuration is not working. For best proxy results, we recommend using the most recent infrastructure ...
Read more >
devServer proxy(in vue.config.js) not working - Get Help
I encountered this problem, too. devServer proxy not working What should i do? vue.config.js exists in root dir of vue project.
Read more >
Server Options - Vite
Enable TLS + HTTP/2. ... Configure custom proxy rules for the dev server. ... When running Vite on WSL2, file system watching does...
Read more >
Apache 2 basic reverse proxy config not working, getting 404 ...
Turns out I was typing localhost/app where it should be localhost/app/ ... Yeah, I know.
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