Failed to load resource: Request header field 'fmyCustomField' is not allowed by Access-Control-Allow-Headers

#1

I receive error during server http call.

Failed to load resource: Request header field lang is not allowed by Access-Control-Allow-Headers.

In my request I need to add a custom header field.

This is my request header.

httpHeaders = {
      headers: new HttpHeaders({
        'Content-Type':  'application/json',
        'Access-Control-Allow-Headers': 'lang',
        'lang': this.session.language
      })
    };

Server side (.htaccess):

Header Set Access-Control-Allow-Origin "*"
Header Set Access-Control-Allow-Headers "*"

Support me please

#2

I solved server side

This configuration doesn’t work

Header Set Access-Control-Allow-Headers "*"

I need to set a list of header fields allowed

Header Set Access-Control-Allow-Headers "Content-Type,Access-Control-Allow-Headers,lang"

Thanks