Well, That was I thought, but I'm passing headers via AJAX and it doesn't work!

I've tried in many ways without success... Just to be clear I'm using TTCPBlockSocket to provide a webservice which will be consumed via webapp (I'm using Angular 2). That webservice works as well, but I'm trying to pass some headers but those headers just disappear when data received at TTCPBlockSocket...

PS: The Http headers into Angular side are going right... I double checked it as well

So I know that headers are being sent because of this line:Access-Control-Request-Headers: access-control-allow-origin,content-type,filterHowever I cant read the entire Headers, with the parameters value... As far as I know (using javascript) in the webservice I just read the request header and get all the stuff needed...

As I see it .append is a function which returns httpheaders. So you should do something like this:let headers = new HttpHeaders();headers = headers.append('Authorization', this.authHeader);headers = headers.append('Accept', 'application/json');headers = headers.append('Content-Type', 'application/json');

Neither POST nor GET methods give me the entire request header... As I said the header property is sent, but I can't get the values... could be that I'm using the wrong function, I really don't know how to get the full header values!

Maybe you specified the headers but they are definitely not sent because otherwise they would be received at the other end.

Also notice that your Access-Control-Request-Headers contains the header-titles you wanted to send:Access-Control-Request-Headers: access-control-allow-origin,content-type,filterDo you see that "filter" at the end.So I think you are using .append the wrong way.(Maybe .append is only used as string function and not function for headers.)

Did you try setting the headers with the following?let headers = new HttpHeaders();headers = headers.append('Filter', 'Hello World');

That way you are sure the .append of headers is used as function and not a string.append function.

The preflight is being triggered by your Content-Type of application/json. The simplest way to prevent this is to set the Content-Type to be text/plain in your case. application/x-www-form-urlencoded & multipart/form-data Content-Types are also acceptable, but you'll of course need to format your request payload appropriately.

If you are still seeing a preflight after making this change, then Angular may be adding an X-header to the request as well.

Unlike “simple requests” (discussed above), "preflighted" requests first send an HTTP request by the OPTIONS method to the resource on the other domain, in order to determine whether the actual request is safe to send. Cross-site requests are preflighted like this since they may have implications to user data.

Another thing that I found was that TTCPBlockSocket don't accept any header attribute!

What do you mean?TTCPBlockSocket doesn't know anything about "headers". It just receives clean data. The data itself should consists of the complete headers and data (separated by a blank line). But TTCPBlockSocket isn't a HTTP-component. So you are dealing with raw data. It accepts all that data.

I meant that the component doesn't work with some header attributes, like I tried execute a post passing "Access-Control-Allow-Origin","*", with that the header looks like as I said previously... So, without that header it works fine! I just had to change the "Content-Type" to "text/plain";

Well, it's my first experience with this kind of function using Laz/FPC, and that was the way that I found to solve the problem! Probably there is an easiest way to do it...