A
A
Andrey2019-05-26 03:08:21
PHP
Andrey, 2019-05-26 03:08:21

How to forward axios requests through a proxy?

Greetings. there is vue-cli3
there is configuration file vue.config.js

module.exports = {
    devServer: {
        proxy: {
            '/functions': {
                target: 'http://genvue.loc',
                changeOrigin: true,
                secure: false
            }
        }
    }
}

There is a GET request like this
axios.get('/functions/sheet.php', {params: {page: page}})
.then((response) => {
     console.log(response.data);
});

As a result, in the console I get just the contents of the php file (code). The proxy won't start. What could be the problem? Google climbed actively

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-05-26
@Robur

If php is given to you there, which lies on genvue.loc, then the problem is in genvue.loc - php is not configured there normally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question