得到错误的Heroku,从问候到HTTPS [英] Getting error from heroku in regards to HTTPS

查看:201
本文介绍了得到错误的Heroku,从问候到HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了有角度和部署了以的NodeJS Heroku上的应用程序。
当我在开发模式下我家的电脑上运行它的一切是真棒,并没有错误发生。但是,一旦我把它交给我的Heroku收到以下错误消息在控制台上:

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.

是否与我怎么称呼从tumblr我的数据的问题?

Is there an issue with how I call my data from tumblr up?

这是我在做什么:

$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
  });

这是我设置了我的server.js文件

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);

我想强调的是,一切正常,除了数据呼叫我做与$ HTTP,我应该用香草JS或jQuery方法?如果是这样,为什么会出现这种情况o.0?

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 ?

另外的原因,它调用/ DIST文件夹,是因为应用是由步兵第一缩小的。

Also the reason it calls a /dist folder is because the app is minified by Grunt first.

推荐答案

试着改变你的API请求这个(使协议相对):

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
  });

这篇关于得到错误的Heroku,从问候到HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆