-
August 3rd, 2018, 10:16 AM
#1
LS Community edition session creation issue
I have downloaded the LS version 7.1 and in LS server configuration I have set as Community edition. And I have created adapter as like I have used in enterprise edition.
I have started LS server everything is working in server. When I try to connect the client it showing the error as like
http://localhost:8080/lightstreamer/create_session.js: Request header field username is not allowed by Access-Control-Allow-Headers in preflight response.
And also I have tried by removing the user name field from connection parameter this also not working.
This always tying to connect the LS server from client.
I have used the below code to connect, And also in server I have mentioned the javascript_client.
define(["LightstreamerClient"],function(LightstreamerClient) {
var protocolToUse = document.location.protocol != "file:" ? document.location.protocol : "http:";
var portToUse = document.location.protocol == "https:" ? "443" : "8080";
var lsClient = new LightstreamerClient(protocolToUse+"//localhost:"+portToUse,"STOCKLISTDEMO_REMOTE");
lsClient.connectionOptions.setHttpExtraHeaders({"u sername" : "myusername"});
lsClient.connectionOptions.setHttpExtraHeadersOnSe ssionCreationOnly(true);
lsClient.connect();
return lsClient;
});
-
August 6th, 2018, 08:23 AM
#2
Hi, This means that the access from your page to the Server is considered by the browser as a CORS request (probably because of the different port).
Consequently, the browser sends a preliminary (i.e. preflight) request to the Server to check if the latter accepts the CORS request.
However, the request is refused because of the presence of the "username" extra http header.
This can be fixed by configuring the Server to allow this header in CORS requests.
This is done in the <cross_domain_policy> block in the Server configuration file, by defining the "accept_extra_headers" attribute accordingly; it should look like:
accept_extra_headers="username"
Then restart the Server and retry (I know you succeeded).
All this matter should be independent from the edition or license with which the Server runs.
Similar Threads
-
By rvkvino in forum General
Replies: 3
Last Post: August 31st, 2018, 10:09 AM
-
By stephenallred in forum Client SDKs
Replies: 1
Last Post: June 7th, 2010, 11:13 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 11:51 PM.
Bookmarks