63
linuxxx
6y

NO FIREFOX AND CHROMIUM, I ALREADY SET THE FUCKING CORS HEADERS CORRECTLY ACCORDING TO THE OFFICIAL FUCKING NGINX DOCUMENTATION. WHY THE FUCK ARE YOU STILL DISALLOWING CROSS-ORIGIN REQUESTS?!

Comments
  • 1
    did you restarted it(nginx)?
  • 2
    @stop Yes haha, all answers online tell to add the headers but I've already done that and can even see them present in the network dev console tab :(
  • 3
    Did you make it for the HEAD request as well?
  • 3
    @plusgut Nope... It's not in the documentation I found online so no 😅
  • 10
    @linuxxx before the browser makes the actual request you are trying to do. It will make a HEAD request to check if the server allows such a request from a foreign domain.
    That's probably the reason why it's not working for you.
  • 3
    Chrome and stackoverflow tells me it does an options not head... oh well I just allowed all from all origins on this project and it seems to work
  • 5
    I think OPTIONS is needed as well.
  • 1
    @demortes haha, same second :D
  • 4
    This cross origin shit is such a pain in the ass. I know its good, but I just hate it for reasons beyond me
  • 1
    @plusgut Any idea on what I should add to my nginx config? :)
  • 7
    Oh right,it was a OPTIONS request,I comfused that
    @linuxxx sorry i'm not much of a server guy

    p.s. thank you so much for your letter, I smiled the whole day after i recieved it
  • 2
    @plusgut Awhhh haha I'm glad! 😊
  • 1
    For me I had to do it on my service, since nginx just redirects to another IP
  • 2
    I face this issue with asp.net and IIS too, allowing OPTIONS request is the solution
  • 1
    I hate it when someone answers my question by re-framing the question - its so helpdesk support like. But, would it not be easier to do CORS on the endpoint rather than server level?
  • 2
    @linuxxx so sorry man that sucks, as the other people up top said last time I had that issue it was all about the pre flight, but sure you have that base covered. Had that CORS battle before, not fun:(
  • 2
    @hubiruchi Yeah same with things which don't allow plain HTTP or self signed SSL certificates. COME ON APP THIS IS MY SAFE SPACE YOU CAN TALK TO ME...

    Security is rarely convenient.
  • 2
    @linuxxx look at this post on stack overflow,

    https://stackoverflow.com/questions...

    I had the same problem with POST and this how i found the anwser.
  • 1
    @SionX Not using node 😬
  • 1
    @linuxxx Yes but next answer is about nginx and explaining option request and that may get you on the right path to a solution
  • 1
    @SionX Oh I see now! Too badly I've already tried that :/
  • 2
    @Ma30h that's what we use at work. I just did a cors.enable with a default of allow all things. I want to use a rewrite rule to rewrite * with the origin. It caused duplicate entries somehow so chrome disregarded all of them and refused my API
  • 1
    @lunorian don't troll lol.
Add Comment