Building Microservices with Go: 9 CORS (Cross-Origin Resource Sharing)

Поділитися
Вставка
  • Опубліковано 16 жов 2024

КОМЕНТАРІ • 18

  • @christianh3619
    @christianh3619 4 роки тому +13

    I finally understand CORS. Thank you for this great series!

  • @thesamurais8036
    @thesamurais8036 3 місяці тому

    ultimate thanks man now my bug fixed

  • @adammontgomery7980
    @adammontgomery7980 3 роки тому +1

    Struggled with CORS in a node app I worked on. Got a lightbulb when you said allowed origins must be set on the backend.

  • @johndoe-lx3zh
    @johndoe-lx3zh 3 роки тому +1

    You are a treasure! Thank you for your work!

  • @leejohnmitchell
    @leejohnmitchell 3 роки тому

    Good explanation and nice example of gorilla. I had this exact problem some months ago and wish I'd discovered this video back then, would have saved me some lost hair!

  • @jub0bs
    @jub0bs Рік тому +1

    Although I appreciate the series, this specific video contains some misleading statements:
    - At 2:54, "CORS is blocking [...]". Don't conflate the Same-Origin Policy (SOP) and CORS. The latter is only meant to relax the former's restrictions. As such, CORS isn't blocking anything; the SOP is.
    - From 4:28 onwards, Nic explains that CORS acts a defence against CSRF attacks. That is not the case. In fact, activating CORS may open the door to more cross-origin attacks than would otherwise be possible.
    - At 5:55, Nic implies that a preflight request is unconditionally issued whenever the client attempts to send a cross-origin request. That's incorrect; some requests, colloquially known as 'simple', do not give rise to preflight requests.

  • @martynjxrez6408
    @martynjxrez6408 3 роки тому

    thank you very much, amazing tutorial

  • @jackma887
    @jackma887 4 роки тому

    hi nic~ What is the syntax of ch(sm) on line 61? Why can it be wrapped in parentheses

  • @bothorsen4292
    @bothorsen4292 4 роки тому

    Hi Nic, thank you for this. Even though I've been using go for a while now, there have been some nice hints in this series. The question I have is if CORS is still a problem if you serve the React site from within go? For example, the site is returned from /index.html and your service is on /api/products.

    • @MrChickenpoulet
      @MrChickenpoulet 4 роки тому

      I guess it is not as it requests resource from the same URL, but well, as cors is sometimes a mystery to me, I would not be suprised if there were issues :D !

    • @0x6e95
      @0x6e95 4 роки тому

      There should be no issues as long as the API and the client is hosted on the same domain. CORS only applies if the client and the server are separated by origin.

  • @dimayasnohurskyi2805
    @dimayasnohurskyi2805 4 роки тому

    The same error with POST requests. Looks like in Validate functions at middleware.

  • @ariel._.9186
    @ariel._.9186 3 роки тому

    Thanks man

  • @peterz1236
    @peterz1236 3 роки тому +2

    Someone misclicked the like button