Why can't I load my app with HTTP in the embedded preview?


#1

If you try to load your site in the preview embedded into the IDE then it won’t load there and you can only load over HTTPS. Why can’t you open your application in the embedded view using HTTP?


Failure of window.location http:inside c9 IDE
#3

To ensure your code is safe, Cloud9 uses the https protocol to load the IDE. That means anything else that is loaded in that browser window must also load via https.

The preview pane uses an iframe to load pages and the browser prevents pages from loading via http (without an “s”). To view a preview with http, open it in a separate tab.


#4

I am trying to open it in a separate tab but its still not working.

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337,'127.0.0.1');
console.log('Server running at http://127.0.0.1:1337');

This is my code.


#5

Hi there, Raju. For C9 server your should use ENV_PORT insted of 127.0.0.1


#6

To clarify, please use process.env.PORT instead of 1337, and process.env.IP instead of 127.0.0.1