mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-05-01 17:39:54 +03:00
fix(warn): Refused to get unsafe header "www-authenticate"
This commit is contained in:
parent
73613a3b96
commit
21e3ad51af
3 changed files with 5 additions and 4 deletions
|
@ -53,7 +53,8 @@ export class Http {
|
|||
case 'loadend': {
|
||||
self.oReq.addEventListener('loadend', function () {
|
||||
if (this.status == 401 && !this.withCredentials) {
|
||||
const tokenAuth = parseAuthenticateHeader(this.getResponseHeader('www-authenticate'));
|
||||
const tokenAuth =
|
||||
this.hasHeader('www-authenticate') && parseAuthenticateHeader(this.getResponseHeader('www-authenticate'));
|
||||
self.onAuthentication(tokenAuth, (bearer) => {
|
||||
const req = new XMLHttpRequest();
|
||||
req._url = self._url;
|
||||
|
@ -65,7 +66,7 @@ export class Http {
|
|||
req.setRequestHeader(key, self._headers[key]);
|
||||
}
|
||||
if (bearer && bearer.token) {
|
||||
req.setRequestHeader('Authorization', `Bearer ${bearer.token}`)
|
||||
req.setRequestHeader('Authorization', `Bearer ${bearer.token}`);
|
||||
} else {
|
||||
req.withCredentials = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue