1

I have a react client on port 8070 I'm getting requests from port 8090

Request: curl -X GET "http://localhost:8090/get/directory" -H "accept: application/json" -H "path: /"

This is how i'm fetching this request:

useEffect(() => {
    const requestOptions = {
      method: "GET",
      headers: {
        "Accept": "application/json",
        "Path": "/",
        "Access-Control-Allow-Origin": "*",
      },
    };
    fetch(
      "http://localhost:8090/get/directory",
      requestOptions
    ).then((response) => console.log(response));
  }, []);

This is what i've got:

image

Maybe someone has any ideas why i'm getting 403 error? Maybe something wrong with how i'm fetching this request?

anthonyro
  • 99
  • 1
  • 11
  • Try hitting this get url in browser and check are you getting the response http://localhost:8090/get/directory – Learner Dec 07 '20 at 11:30
  • Is cors enabled on your back end – Learner Dec 07 '20 at 11:31
  • @DILEEPTHOMAS this is what i've got "Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Mon Dec 07 11:32:23 GMT 2020 There was an unexpected error (type=Bad Request, status=400)." – anthonyro Dec 07 '20 at 11:33
  • Is the backend is written in java, check this one i don't have much context on java https://stackoverflow.com/questions/31134333/this-application-has-no-explicit-mapping-for-error – Learner Dec 07 '20 at 11:34
  • 1
    @DILEEPTHOMAS yeah in java. ok, thanks, i'll check – anthonyro Dec 07 '20 at 11:36

0 Answers0