1

Here (https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) it is mentioned

The port number is checked separately by the browser. Any call to document.domain, including document.domain = document.domain, causes the port number to be overwritten with null. Therefore, one cannot make company.com:8080 talk to company.com by only setting document.domain = "company.com" in the first. It has to be set in both so their port numbers are both null

I am new to this and have a bit of confusion. What is the meaning of setting the port number to null? How are HTTP requests made then if the port is no longer 80/443?

2
  • 1
    See stackoverflow.com/questions/1481251/…
    – mti2935
    Sep 2, 2020 at 14:12
  • Since I do not have enough reputation to comment in StackOveflow, I am asking it here. Suppose I have 4 origins ['a.b.com', 'b.com', 'a.b.com:3000', 'b.com:3000'] and I set document.domain = 'b.com' in all of them, will the browser treat all four as same origin since the port is set to null for all of them?
    – positron
    Sep 7, 2020 at 13:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.