I have an app written with angular and deployed over nodejs to heroku. When I run it in development mode on my home computer everything is awesome, and no errors occur. But once I deliver it to heroku I get the following error message on the console:
Mixed Content: The page at 'https://yasawebsite.herokuapp.com/#/' was loaded
over HTTPS, but requested an insecure script
'http://api.tumblr.com/v2/blog/asayorku.tumblr.com/posts?api_key=[MY SECTRET API-KEY]&callback=angular.callbacks._0'.
This request has been blocked; the content must be served over HTTPS.
Is there an issue with how I call my data from tumblr up?
this is what I am doing:
$http.jsonp('http://api.tumblr.com/v2/blog/asayorku.tumblr.com/posts?api_key=[MY SECRET API Key]&callback=JSON_CALLBACK')
.success(function (data) {
// my data analysis process
});
And this is what I have setup over at my server.js file
var express = require('express')
, morgan = require('morgan')
, bodyParser = require('body-parser')
, methodOverride = require('method-override')
, app = express()
, port = process.env.PORT || 3000
, router = express.Router();
app.use(express.static(__dirname + '/dist'));
app.use(morgan('dev'));
app.use(bodyParser());
app.use(methodOverride());
router.get('/', function(req, res, next) {
res.render('index.html');
});
app.use('/', router);
app.listen(port);
console.log('App running on port', port);
I'd like to stress that everything works except for the data call I make with $http, should I be using the vanilla js or jquery methods? if so why is this happening o.0 ?
Also the reason it calls a /dist folder is because the app is minified by Grunt first.
Try changing your API request to this (make the protocol relative):
$http.jsonp('//api.tumblr.com/v2/blog/asayorku.tumblr.com/posts?api_key=[MY SECRET API Key]&callback=JSON_CALLBACK')
.success(function (data) {
// my data analysis process
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With