DRF+Axios: some requests fail with `ERR_NETWORK` or `ERR_BLOCKED_BY_CLIENT`

This is not a question, more like an answer to this common problem.

I have a Dashboard built with NextJs and Django+DRF and i am using axios as a HTTP Client.

i have noticed that some of my requests go through, and some do not (mainly the requests that fetch for example monthly/yearly payments/expenses of the company).

Down below you'll find the solution to this problem.

Solutions that might fix this issue:

  • Setup CORS properly on your django server settings.py:
    # CSRF
    # Either Update Axios settings or Django Settings

    # CORS
    CORS_ALLOW_ALL_ORIGINS = True # Do not run your production server with this setting

    from corsheaders.defaults import default_headers
    CORS_ALLOW_HEADERS = list(default_headers) + [
        'access-control-allow-headers', # this one is important


  • If your are running Ublock Origin or any browser extension of this sort, turn it off for and localhost
  • For Brave browser, turn off the shield for and localhost
  • That's it, hope it helps.

i solve similar problem in Django(not DRF), it reproduce when try to deploy django+gunicorn+nginx in compose.

But i use https://pypi.org/project/django-cors-headers/

#settings.py just add:




#and add your site address with ports
Back to Top