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.

proxyTable with Axios

See original GitHub issue

Hi to all,

i’m trying to configure proxyTable, and i have just copied the example in documentation:

proxyTable: {
// proxy all requests starting with /api to jsonplaceholder
     '/api': {
         target: 'http://jsonplaceholder.typicode.com',
         changeOrigin: true,
         pathRewrite: {
             '^/api': ''
         }
     }
 },

After that, i have run npm run dev (i have added this on config/index.js).

When i try to use axios, the requests are sent to http://localhost:8080 and not to http://jsonplaceholder.typicode.com.

the request sent with axios is quite simple:

axios.get('/api/1') // Just for example

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
puppeteer701commented, Feb 5, 2017

I would also like to know this, because I moved from vue-resources to axios and proxyTable in webpack is not working anymore. Any suggestions?

3reactions
LinusBorgcommented, Jan 24, 2017

When i try to use axios, the requests are sent to http://localhost:8080 and not to http://jsonplaceholder.typicode.com.

Well, the request will of course be sent to localhost:8080, which will then send the request to http://jsonplaceholder.typicode.com - that’s what proxys do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue ProxyTable does not work in axios - Stack Overflow
But it don't work in axios,the error says GET http://localhost:8085/api/user/login?username=xx&password=123 504 (Gateway Timeout) .
Read more >
API Proxying and axios - Get Help - Vue Forum
Hi to all, i'm trying to configure proxyTable, and i have just copied the example in documentation: proxyTable: { // proxy all requests...
Read more >
API Proxying During Development · GitBook
proxyTable option in config/index.js . The dev server is using http-proxy-middleware for proxying, so you should refer to its docs for detailed usage....
Read more >
vue axios 设置proxyTable跨域后访问接口404 - CSDN博客
描述我是用的是本地IP启动我的项目我想访问的接口是http://192.168.100.217:2000/api/OrganizationManager/Get_Load这是我proxy的配置代码proxyTable: ...
Read more >
通过axios自带的proxytable配置跨域为什么没有效果呢?
axios 有一个自带的proxytable属性看文档是用来设置请求代理的但是设置之后并没有效果呢? 另外react项目一般是怎样请求代理的呢? 3 回复. waitingsong 1楼•3 年前.
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