Calling django api routes with middleware.
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
I am using django for authentication and authorization so I want to have nextjs make an api call to django to check for authorization to access a page. I tried calling the backend through the middleware but I've gotten some weird error when doing that.
3 Replies
@James4u what error do you get? <@210245222238519296>
Masai LionOP
[cause]: Error: connect ECONNREFUSED 127.0.0.1:443
2024-07-20T05:16:14.881029210Z at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)
2024-07-20T05:16:14.881030752Z at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2024-07-20T05:16:14.881032127Z errno: -111,
2024-07-20T05:16:14.881034543Z code: 'ECONNREFUSED',
2024-07-20T05:16:14.881038210Z syscall: 'connect',
2024-07-20T05:16:14.881039585Z address: '127.0.0.1',
2024-07-20T05:16:14.881040918Z port: 443
2024-07-20T05:16:14.881042502Z }
2024-07-20T05:16:14.881043918Z }this happens whenever i try to fetch my django backend on any server component