I am trying to set CORS rules on my Azure Blob Storage account by following these instructions.
This is the error I receive after making my request:
For people reaching this page and wondering why you get this error even though you are using a Shared Access Signature URL, then you most likely are sending YOUR APP token to Azure. Make sure to NOT include the Authorization header in this case.
The request has an incomplete Authorization header. It needs to contain the authentication scheme, storage account name, and signature. For example;
Authorization: SharedKey myaccount:Z1lTLDwtq5o1UYQluucdsXk6/iB7YxEu0m6VofAEkUE=
For more information, see Authentication for the Windows Azure Storage Services. On the other hand, if you use one of the Windows Azure Storage Client Libraries, it will handle the authentication for you. For .NET library, please see our NuGet package.
Following what @jsgoupil said:
For people reaching this page and wondering why you get this error even though you are using a Shared Access Signature URL, then you most likely are sending YOUR APP token to Azure. Make sure to NOT include the Authorization header in this case.
In case you have an interceptor you can add a skip to a request by following the instructions on this stackOverflow post: https://stackoverflow.com/a/49047764/5232022
export const InterceptorSkipHeader = 'X-Skip-Interceptor'; // <-- ADD THIS
@Injectable()
export class SkippableInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// Add the following if to your interceptor
if (req.headers.has(InterceptorSkipHeader)) {
const headers = req.headers.delete(InterceptorSkipHeader);
return next.handle(req.clone({ headers }));
}
... // intercept
}
}
Then whenever you want to skip the interception for a particular request:
const headers = new HttpHeaders().set(InterceptorSkipHeader, ''); // <-- this will skip it
this.httpClient.get<ResponseType>(someUrl, { headers }) // <-- dont forget to add it here as well