Django Admin Page gives 403 Forbidden error

I have a django website hosted on AWS using Copilot. The admin page keeps giving a 403 forbidden error, while rest of the views work fine.

Here is my settings.py config -

I saw mutliple issues on this topic but none of them seem to have a clear solution how to fix this.

Side note. Please do not post images of code here. Copy/paste the code into the body of your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```.

Do you have more details about the specific 403 error being thrown? What is the complete response being returned by the server? What about the server logs?
There are many things that can throw a 403. Knowing which specific 403 is being issued is important to know what the solution would be…

You may want to log these environment variables to verify that they’re what you’re expecting them to be.

Hey Ken,

Thanks for the reply. I figured out the issue was being raised by the AWS loadbalancer where it was directly blocking requests made to the django admin portal. This might be useful to document but I found a way around to fix it.

Appreciate your help. Thanks!