Django microservice authentication problem.

85 views
Skip to first unread message

Mohammad Anarul

unread,
Jan 28, 2023, 1:53:12 AM1/28/23
to django...@googlegroups.com
How to communicate and authenticate with multiple Django servers. Is it possible?

If possible you can help me, I am trying more than 15 days in this section but not getting any solution.

Please share with me any requirements like books, videos, blogs, or code examples.

Steven Mapes

unread,
Jan 28, 2023, 8:55:26 AM1/28/23
to Django users
Are you trying to authenticate via Django Rest FrameWork API or via the standard Django authentication system?  It shouldn't really matter which it is as both can be scaled horizontally and you'll have no issue with authenticating so in order for us to help we'd need to understand what you are doing better.

For example are you trying to share the database across multiple domains? Are you simply placing multiple servers behind a load balancer on the same domain?

Lauro Cesar de Oliveira (olarva)

unread,
Jan 29, 2023, 1:53:26 AM1/29/23
to Django users
Hello there.

First thing: show us the error.

Getting status code 400?

Probably a wrong setting of one of those (or maybe all): 

ALLOWED_HOSTS
CORS_ALLOWED_ORIGINS
CSRF_TRUSTED_ORIGINS
CSRF_USE_SESSIONS
MIDDLEWARE


When working with  microservice make sure the reverse-proxy/loadbalance is setting the right headers...


As example, my Nginx reverse proxy setup always set the follows headers:

        proxy_set_header Host localhost;
        proxy_set_header ServerName localhost;
        proxy_set_header Origin http://localhost;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Forwarded-HostName $host;    

Mohammad Anarul

unread,
Feb 3, 2023, 12:50:06 AM2/3/23
to django...@googlegroups.com
Thanks, guys The Django user group is very helpful.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4fd67d8d-3b48-4852-abe6-d97a8bd94c2bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages