Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    74

    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;
    });

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    957
    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

  1. Replies: 3
    Last Post: August 31st, 2018, 11:09 AM
  2. Replies: 1
    Last Post: June 7th, 2010, 12:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 01:27 AM.