Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cookie being set by an image?

Tags:

http

cookies

I am trying to work out how cookies are being set on a website, I have scoured the page source and can see how most of them are being generated.

However, there is one cookie that appears on page load that I can't track down.

Is it possible that a cookie is being set when an image is being requested from a remote server? If so, can I inspect that http request response with a tool to find out if it contains the cookie?

like image 230
fightstarr20 Avatar asked Jan 02 '23 22:01

fightstarr20


2 Answers

Any HTTP-Request can set a cookie, if the server says so.

Cookies are set using the Set-Cookie HTTP header, sent in an HTTP response from the web server.

https://en.wikipedia.org/wiki/HTTP_cookie#Setting_a_cookie

like image 160
maio290 Avatar answered Jan 13 '23 11:01

maio290


A request for an image is basically the same as a request for a html page. It uses the same request/response structure. So yes you can set a cookie on an image request.

The request/response can be seen in most modern browsers. In FireFox there is under tools -> Web Developer -> Network a tool that shows the requests/responses from all calls being made on a page. Opera and Chrome have similar functionality.

like image 45
hertog Avatar answered Jan 13 '23 13:01

hertog