Code Monkey home page Code Monkey logo

Comments (9)

beneshed avatar beneshed commented on August 19, 2024

Also i've been trying to log through it and seems that only the request is being processed, but not the response

from django-cors-headers.

ottoyiu avatar ottoyiu commented on August 19, 2024

Can you perhaps paste some of those logs to help with the debugging?

from django-cors-headers.

d0nezer0 avatar d0nezer0 commented on August 19, 2024

@ottoyiu :
I got the settings like @thebenwaters , and I call my login url and pass the username and password arguements. But it returns a 403 "NetworkError: 403 FORBIDDEN - http://sso.acttao.com:8888/zgxcw/login/".

    My login view returns a url at first.   ------return redirect('zg_login')
    After, I return a response and still returns the 403.

    the CORS url must return a response?
    what might causes my issue?
    Thanks a lot.  Need help urgently.

from django-cors-headers.

d0nezer0 avatar d0nezer0 commented on August 19, 2024

It does not need to return a response object.
the reason is the shot of settings .
The settings of mine is below.
CORS_ORIGIN_ALLOW_ALL and CORS_ORIGIN_WHITELIST choose one is OK .

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = False
CORS_ORIGIN_WHITELIST = (
'zgxcw.acttao.com:8002',
'hostname.example.com'
)

At first I lost CORS_ALLOW_CREDENTIALS = True.
and I checked the source code middleware.py
line 57:
response[ACCESS_CONTROL_ALLOW_ORIGIN] = "*" if (
settings.CORS_ORIGIN_ALLOW_ALL and
not settings.CORS_ALLOW_CREDENTIALS) else origin

from django-cors-headers.

d0nezer0 avatar d0nezer0 commented on August 19, 2024

403 again!
I didnot find the real reason of 403.

from django-cors-headers.

d0nezer0 avatar d0nezer0 commented on August 19, 2024

I hope can help someone with my fail log.
Now, I pass the arguements (username and passwd) from a site to server site,
and called the login function.

But did not login successfully.
I thought might be the cookie did not set successfully.
If anyone has a suggestion is welcome.

from django-cors-headers.

brad avatar brad commented on August 19, 2024

There are a plethora of reasons you might be getting a 403. For me, the fix was to set the withCredentials XHR option to true. A jquery example:

$.ajax({
   url: a_cross_domain_url,
   xhrFields: {
      withCredentials: true
   }
});

from django-cors-headers.

d0nezer0 avatar d0nezer0 commented on August 19, 2024

@brad
Thanks for your suggestion.
I did my project whitout cross domain this time .
I would like to check it with my spare time.

from django-cors-headers.

adamchainz avatar adamchainz commented on August 19, 2024

Closing due to inactivity

from django-cors-headers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.