Search code examples
facebooksslcanvashttpsfacebook-apps

Using localhost for Secure Canvas URL on Facebook App


I need to develop a Facebook app, and while I request my SSL certificate, I need to start the project because I have few time to deliver it. Is it possible to use localhost as the "Secure Canvas URL"? This field requires that the URL begins with https, so I don't know the correct way to do it (in the case that using localhost is allowed).


Solution

  • First of all you need to set up your server to answer HTTPS requests.
    Then you create a self-signed SSL certificate – not sure if that works for the domain name localhost, but I’d recommend setting up a local domain, such as mytest.local anyway (the .local being the important part here), make your server listen to that, and your system resolve it to your local IP address, f.e. via its hosts file.

    And then you tell your browser to accept that self-signed certificate … and you’re good to go.