Skip to content

Call API behind proxy #5607

Closed
Closed
@lynn901213

Description

@lynn901213

Hi,

I am facing an issue to call apis behind corporate proxy to AWS backend server. I need to deploy the vue.js frontend on a corporate network, which has proxy setup for security reasons. In order to send http request to outside network, the request has to go through the proxy. So far I have tried 4 things

  1. use axios 'proxy' param
    let ax = axios.create(proxy: {host: , port: })
    ax({method: 'get', url: }.then(...).catch(...))

  2. use https agent
    const HttpsProxyAgent = require('https-proxy-agent');
    const axiosDefaultConfig = {
    proxy: false,
    agent: new HttpsProxyAgent('')
    };
    const ax = require('axios').create(axiosDefaultConfig);
    ax({method: 'get', url: }.then(...).catch(...))

  3. https tunnel

  4. using fetch instead of axios, and add https agent to fetch.

None of them works to pass the api through proxy. I am not getting an error message in any case, and by pulling out the network log I knew the api was never attempt to send through proxy. It is always from my local machine directly to the aws server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions