cors-anywhere
cors-anywhere copied to clipboard
API domain name resolution problem
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:
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"