Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Lms cors

  1. #1
    Senior Member sckramer's Avatar
    Join Date
    Oct 2008
    Posts
    304

    LMS CORS Access-Control-Allow-Origin

    Name:  Screen Shot 2018-07-30 at 6.18.33 AM.png
Views: 283
Size:  160.7 KB

    Hello,

    I can't call the LMS api direct from javascript (browser) --> any chance the required header(s) (Access-Control-Allow-Origin) could be added to the LMS server responses?

    *Feature Request

    Thanks!!
    Scott
    Last edited by sckramer; 2018-07-30 at 03:42.
    Scott Kramer

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,316

    Lms cors

    > I can't call the LMS api direct from javascript (browser) --> any chance
    > the required header(s) (Access-Control-Allow-Origin) could be added to
    > the LMS server responses?


    I'm not saying this is going or not going to happen. But I see an
    increased interest in this... added it to my list.

    --

    Michael

  3. #3
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,316

    Lms cors

    > I can't call the LMS api direct from javascript (browser) --> any chance
    > the required header(s) (Access-Control-Allow-Origin) could be added to
    > the LMS server responses?


    Could you please provide me with a very simple test page which would be
    using this?

    --

    Michael

  4. #4
    Senior Member sckramer's Avatar
    Join Date
    Oct 2008
    Posts
    304
    Sure!

    Working on it now--

    Thank You
    Scott Kramer

  5. #5
    Senior Member sckramer's Avatar
    Join Date
    Oct 2008
    Posts
    304
    Here you go... just type in your lms ip address, hit enter.

    ---> lms CORS api test

    Best to have dev tools / console open to see the CORS messages (not sure how to capture those yet for the ui)

    To test the successful case (and make the output examples), had to set up a web server along side LMS on the same server, matching ip addresses let it work.

    Name:  Untitled.png
Views: 248
Size:  137.7 KB
    Last edited by sckramer; 2018-07-30 at 14:27.
    Scott Kramer

  6. #6
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,316
    Like this? :-)

    Name:  Bildschirmfoto 2018-07-30 um 23.29.13.png
Views: 245
Size:  100.2 KB

    I did try to implement this during a train ride... needs some more work, but I'm getting close. Much to my surprise I never got the OPTIONS call.
    Michael

    http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo

  7. #7
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,316

    Lms cors

    Please give it a try... next builds should have it.
    Settings/Advanced/Security

    --

    Michael

  8. #8
    Senior Member sckramer's Avatar
    Join Date
    Oct 2008
    Posts
    304
    Quote Originally Posted by mherger View Post
    Like this? :-)

    I did try to implement this during a train ride... needs some more work, but I'm getting close. Much to my surprise I never got the OPTIONS call.
    Haha, NICE!

    OPTIONS comes up if Content-Type is set to application/json -- 405 method not allowed (I had it set text/plain).

    Updated the test with a selector for that.

    Name:  Screen Shot 2018-07-31 at 8.01.00 AM.png
Views: 229
Size:  140.6 KB
    Scott Kramer

  9. #9
    Senior Member sckramer's Avatar
    Join Date
    Oct 2008
    Posts
    304
    Quote Originally Posted by mherger View Post
    Please give it a try... next builds should have it.
    Settings/Advanced/Security

    --

    Michael
    Wow that was quick, I'll try it out. Thanks!

    PS. was writing up my last post and you replied during!
    Last edited by sckramer; 2018-07-31 at 07:57.
    Scott Kramer

  10. #10
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,316

    Lms cors

    > Wow that was quick, I'll try it out. Thanks!

    Does it work for you?


    --

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •