React axios net::ERR_HTTP2_PROTOCOL_ERROR 200 when sending request with authorization header

Viewed 60

I am trying to send axios GET request from React to backend hosted on localhost (.Net 6.0).
Without authorization header I have response with my data, but when I try to attach autorization header I got error: net::ERR_HTTP2_PROTOCOL_ERROR 200

let responseData: MyType[] =  await axiosInstance
    .get("*endpoint*", {
      headers: {
        Authorization: `Bearer *BEARER*`,
      },
    })

It works the same with every request I am trying to send from my app.

axios Instance file looks like this:

import axios, { AxiosError } from "axios";

const axiosInstance = axios.create({
  baseURL: "https://localhost:42310/",
});

export default axiosInstance;

I've managed to check more details about this error and in HTTP2 session I have following error: chrome-net error screen

I am using Google Chrome to run my app, but error occurs also in Edge.
In Postman everything works fine (with and without authorization header).

Do you have any idea what could cause described problem?

0 Answers
Related