LoginSignup
2
1

More than 5 years have passed since last update.

Set-Cookie 時にドメインを指定する/しないで、保存される ドメイン が異なる

Posted at

Set-Cookie 時にドメインを指定する/しないで、保存される ドメイン が異なるようです。

ドメインを指定しない場合

レスポンスヘッダの Set-Cookie で、ドメインを省略した場合は、保存された Cookie のドメインは、そのサイトのドメイン (FQDN) となる。

ドメインを指定した場合

レスポンスヘッダの Set-Cookie で、ドメインを指定した場合は、保存された Cookie のドメインは、指定したドメインの先頭に “.” (ドット) が付く。

重要

ドットが付いている Cookie と付いていない Cookie ではアクセスレベルの意味が変わるので注意。ドットが付いている Cookie はサブドメインにアクセスした際にも送信される。
chromeだと別々に認識するみたいです。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1