Skip to content

Requests to https through proxy #3903

@Alek5andr

Description

@Alek5andr

Is your feature request related to a problem? Please describe.

Axios 0.21.1 does not cope with requests through proxy to secured URLs - HTTP code 501 is received.
I'm behind corporate network. When I try to launch the following code, the error 501 is received:

const axios = require("axios");

axios.get('https://jsonplaceholder.typicode.com/todos/12', {
    proxy: {
        protocol: 'http',
        host: 'corporate.proxy',
        port: 9000
    },
})
    .then(response => response.data)
    .then(data => console.log(data))
    .catch((error) => {
        const errorMessage = error.message;
        const responseData = error.response && error.response.data;
        console.log('error')
        console.log(`${errorMessage}${
            responseData
            && typeof responseData === 'object'
                ? `: ${JSON.stringify(responseData)}`
                : ''}`)
    });

Requests made to unsecured URLs - http protocol - with or without proxy settings succeed.

Describe the solution you'd like

Fix or implement please a possibility to perform requests to secured URLs - https protocol - through proxy.

Describe alternatives you've considered

Instead of using "axios" module, the module "axios-https-proxy-fix" solves the issue. However, it's some old fix. And most probably does not update to new features that original Axios may bring. Definitely I would like to stick to primary.

Additional context

No solution is found around the original source.

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