Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API domain name resolution problem #461

Open
MATACE opened this issue May 15, 2023 · 2 comments
Open

API domain name resolution problem #461

MATACE opened this issue May 15, 2023 · 2 comments

Comments

@MATACE
Copy link

MATACE commented May 15, 2023

In the file cors-anywhere.js the code var location = parseURL(req.url.slice(1)) have some problem.
When I send an axios request

        const proxyUrl = 'http://127.0.0.1:38000/';         // my cors-anywhere server
        const targetUrl = 'http://localhost:38080/api/v5/configs/broker';

        axios
            .get(proxyUrl + targetUrl, {
                auth: {
                    username: username,
                    password: password,
                },
                headers: {
                    'Content-Type': 'application/json',
                },
            })
            .then((response) => {
                console.log(response.data)
            })
            .catch((error) => {
                console.log(error)
            })
    })

The value of this req.url.slice(1) is http://localhost:38080/api/v5/configs/broker
When I send an other axios request

        const proxyUrl = 'http://5c62ur.natappfree.cc/scros/';
        const targetUrl = 'http://5c62ur.natappfree.cc/mqtt/api/v5/configs/trace';

        axios
            .get(proxyUrl + targetUrl, {
                auth: {
                    username: username,
                    password: password,
                },
                headers: {
                    'Content-Type': 'application/json',
                },
            })
            .then((response) => {
                console.log(response.data)
            })
            .catch((error) => {
                console.log(error)
            })
    })

The value of this req.url.slice(1) is http:/5c62ur.natappfree.cc/mqtt/api/v5/configs/broker,There is a / missing after http:

@bulk88
Copy link
Contributor

bulk88 commented Oct 15, 2023

You have a bug, with the cloudflare edge proxy, "normalizing", accidentally or intentionally, your URL. I think a patch I wrote and it was merged public to CORS-A fixed this parsing problem of "myapp.herokuapp.com/https:/foo.com/home"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@bulk88 @MATACE and others