CSRF verification failed. Request aborted in http URL

enter image description here

In my login showing error when submit the form in http url but https url working fine.

my login form is ` {% csrf_token %} Please log in Or click here to register {% if msg %} Error Invalid credentials or inactive account. If you have registered please make sure to activate your account by clicking on the link sent to your email address. Please check your spam folder if you are unable to find the email. {% endif %}

      <input type="text" class="form-control" name="email"
        placeholder="Email Address" required="" autofocus=""
        ng-model="loginEmail"></input> <input type="password"
        class="form-control" name="password" placeholder="Password"
        required="" ng-model="loginPwd"></input>

      <button class="btn btn-lg btn-primary btn-block" type="submit"
        ng-click="login(loginForm.username.$viewValue, loginForm.password.$viewValue)">Log in</button>

localhost working proper this code but live site not working in http. Also i add {% csrf_token %} in login form please someone help me!

Add a {% csrf_token %} to your form. Should cover you for the issue.

Add this option to the settings:



You need to put your own website as a trusted origin since django 4.0.

You will need to add this to your settings.py if you are using http:

Back to Top