0

I try to fetch file hosting with browser. i disable cors web security with extension https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf?hl=en. i tested. fetch return the html. but the problem i dont get the response headers. like cookie. it just give me 4 key. i need that response header cookie to do next fetch.

const initHeader = new Headers()
initHeader.append('accept', '*/*')
initHeader.append('connection', 'keep-alive')
initHeader.append('user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36')
fetch('https://www56.zippyshare.com/v/d0M2gx7X/file.html', {
    method: 'GET',
    headers: initHeader
}).then(function(res) {
    res.headers.forEach((val, key) => {
        console.log(key + ': ' + val)
    })
})
  • The question is unclear. Can you elaborate? – jabaa Apr 26 '22 at 17:06
  • @jabaa i think its already clear. cors policy make cant fetch different origin remote. but with that extension. it disable taht policy and allow to fetch. with curl in server side. each visit any zippyshare url. it gives cookie response. but with fetch in browser. it only give that 4 key. `cache-control, content-language, content-type, expires`. set-cookie header missing from response header. – jack spectre Apr 26 '22 at 17:23
  • From [fetch: Getting cookies from fetch response](https://stackoverflow.com/questions/39188376/fetch-getting-cookies-from-fetch-response): _"fetch() won't receive cross-site cookies. You can’t establish a cross site session using fetch(). Set-Cookie headers from other sites are silently ignored."_ But somehow I'm not sure, this is valid. You could try `credentials: "same-origin"` or `credentials: "include"`. – jabaa Apr 26 '22 at 17:34

0 Answers0