Reputation: 9269
I am trying to access images locally in an HTML file from a build server which requires authentication. Below is the example code.
<html>
<head>
<title>Build Report</title>
</head>
<body>
<img width="30%" src="https://ci-system.net/project/build/build-1/image-1.png"/>
<img width="30%" src="https://ci-system.net/project/build/build-1/image-2.png"/>
</body>
</html>
I have already signed in to the server in the same browser session. When I open the HTML file in the same browser session, each image tag is trying to authenticate again with the authentication server and these requests are successful without entering the credentials again. In the below image, I have highlighted the two requests for two images.
But when I enter the URL of the image in the browser directly, it does not require re-authentication, I assume it is because of Session Cookies from the build server.
Why are not the session cookies from the Build server reused when I access these images from the HTML file directly and try to reauthenticate for each image separately?
Upvotes: 0
Views: 641
Reputation: 943556
You've configured your browser to "isolate other cross-site cookies" so, when you open the HTML document on a different origin, it uses a different cookie jar which does not contain your logged in session cookies.
Upvotes: 1
Reputation: 43481
Because GET requests does not add any additional headers. You should add login token into image URL or use some API for it
Upvotes: 0