Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

SSL Issues

Discussion in 'Multiplayer' started by tbigfish88, Dec 21, 2016.

  1. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    Hi,

    I'm using UnityWebRequest to perform POST operations across HTTPS. I've tried and tested with HTTP, and it all works. When I switch to HTTPS, the UnityWebRequest returns an error with the text "Unable to complete SSL connection".

    There doesn't seem to be any more helpful information than this in the error, and I can't find anything on a Google. Can anyone help me out?

    Cheers

    Nick
     
  2. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    902
    If the destination uses https, the original sender needs https, too. How to do this in Unity? ...no clue. Let me know if you find out ;)
     
    tbigfish88 likes this.
  3. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    Is it not possible to configure UnityWebRequest to use HTTPS?

    Failing this, how can I communicate with a server from the WebGL client using HTTPS? I can't just use HTTP, the traffic would all be viewable.
     
  4. nate_sewell

    nate_sewell

    Joined:
    Aug 3, 2016
    Posts:
    5
    What protocol are you using on your server?

    I had my server set to TLSv1.2 and TLSv1.1 and was receiving the same error message that you are getting. I weakened it to include TLSv1 as well (in the server configuration) and now I'm getting proper connects and responses using UnityWebRequest to create POST queries to my rest API

    hope this helps
     
  5. Morvar

    Morvar

    Joined:
    Sep 30, 2013
    Posts:
    4
    If you ever find a way which enables TLS 1.2 security in Unity please let me know too. I've already abandoned all hope..
     
  6. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    So is there seriously NO WAY to send HTTPS requests from a WebGL program? How am I supposed to communicate with my server? :/
     
  7. nate_sewell

    nate_sewell

    Joined:
    Aug 3, 2016
    Posts:
    5
    HTTPS works fine with UnityWebRequest, if you can change the ssl protocol on your server to TLSv1. SSL variants will probably work as well but are even less secure. I'm using Unity 5.2 where the UnityWebRequest class was first introduced.
     
  8. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    Many thanks for your answer Nate! I was beginning to become seriously concerned about our project's future!

    If possible, can you provide any detail on TSL configuration, certificate configuration and/or the configuration of UnityWebRequest? As I said, I have our current application working across HTTP, but I haven't configured HTTPS before, so any help would be gratefully received! :)

    Many Thanks,

    Nick
     
  9. nate_sewell

    nate_sewell

    Joined:
    Aug 3, 2016
    Posts:
    5
    OK, for starters are you using apache or nginx as your server? I can help with those. If you're using IIS it's probably still doable, but I don't have as much experience with that.

    The certificate is the same regardless of protocol used
     
  10. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    I'm using IIS. I've had a tinker, but it seems non-obvious. Any help gratefully received!

    Nick

    (PS - Happy New Year!)
     
  11. nate_sewell

    nate_sewell

    Joined:
    Aug 3, 2016
    Posts:
    5
  12. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    I've added keys for TLS 1.2 > Server > Enabled = 0, TLS 1.1 > Server > Enabled = 0, and TLS 1.0 > Server > Enabled = 1.

    I'm still getting an Unknown SSL protocol error, so I'm not sure whether it worked and I have SSL set up incorrectly, or whether it didn't work. :/
     
  13. nate_sewell

    nate_sewell

    Joined:
    Aug 3, 2016
    Posts:
    5
    hmm, does the link work through your browser? to set up ssl in general you should just need to bind the https port on the server.
     
  14. tbigfish88

    tbigfish88

    Joined:
    Nov 9, 2015
    Posts:
    35
    Success! I hadn't registered the certificate successfully. I now have TLS 1.0 working from WebGL. Many thanks for your assistance Nate.
     
  15. dttngan91

    dttngan91

    Joined:
    Nov 21, 2013
    Posts:
    80