405 method not allowed while refreshing JWT Token – Django, Angular

I’m using JWT Authentication in my Django/Angular project and weird thing happens when I’m trying to get a new access token when the old one expired.

I get a 405 POST METHOD NOT ALLOWED. I’ve set up corsheaders to allow all the methods and external hosts to access the app.
The request looks fine as I’m sending the refresh token to get a new access token.

What I’ve noticed is that it happens only on the pages which are sending POST request to django to access some data before displaying it.
When I’m on a page that sends GET request or nothing, obtaining new token works perfectly good.

Please take a look at the code and the responses.

Error response
Error response





Handling 401 error and getting a new token in angular

       private handle401Error(request: HttpRequest<any>, next: HttpHandler ) : Observable<any> {
        if(!this.isRefreshing) {
            this.isRefreshing = true;

            return this.userService.refreshToken().pipe(
                switchMap((token:any) => {
                    this.isRefreshing = false;

                    return next.handle(this.addToken(request, token.access));
        } else {
            return this.refreshTokenSubject.pipe(
                filter(token => token != null),
                switchMap(access => {
                    return next.handle(this.addToken(request, access));

    refreshToken() {
        return this.http.post(`${this.apiUrl}/api/token/refresh`, {
          'refresh': this.getRefreshToken()
        }).pipe(tap((tokens: any) => {
        }, err => {

I’ve tried with corsheaders, I’ve tried to print all the data that is being sent and all the interceptors but I’m out of ideas.

Is there a chance those POST requests switch somehow and they go to wrong urls?

What is the proper way to continuously/lazy load data from Django into Angular

I am trying to create a blog where all the comments get loaded on each blog post page. The issue is that some posts can contain a few comments which takes seconds to load while others can contain well over 100 which will take a lot longer. I want to load each comment independently one after another to decrease waiting time so they can work seamlessly but I dont know if this is the best approach. Assuming I cant use pagination(I need it as one continuously list), what would be the best method/approach?