I develop a react project and my problem is that fetch only works if I have an additional '?#' at the end of the current url of the page I am currently located.
cors origin is set to '*' on the target server.
My fetch request:
fetch("http://localhost:3000/getAIRes/" + input)
.then((res) => res.json())
.then(
(result) => {
console.log(result);
},
(error) => {
console.log(error.message);
}
);
The behaviour of fetch if run at following locations:
http://example.com/home=> fetch throws an "TypeError: Failed to fetch" error.http://example.com/home?#=> fetch works perfectly fine.
I tried using axios, an alternative to fetch, but neither do i get a response nor is a error thrown:
axios.get("http://localhost:3000/getAIRes/" + input).then(
(response) => {
console.log(response.data);
},
(error) => {
console.log(error);
}
);
How is this possible?