dongtuo4132 2016-03-20 11:47
浏览 52

向Heroku PHP API发送请求时未找到请求标头

First time Heroku user!

My php api has a authentication method for an iOS app:

public function authenticateAppKey() {
    if (!isset($_SERVER['HTTP_APP_KEY'])) {
        error('App Key Not Supplied');
        exit;
    } else if ($_SERVER['HTTP_APP_KEY'] != self::$api_key) {
        error('App Key Incorrect');
        exit;
    }
}

It is always returning App Key Not Supplied

This has always worked up until I have switched to Heroku, wondering if I have missed a setting during the Heroku setup.

These are my build packs:

enter image description here

I also have https://github.com/travstoll/heroku-buildpack-php installed on the server

Deployment Log if helpful:

-----> Using set buildpack heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
       NOTICE: No runtime required in composer.lock; using PHP ^5.5.17
       - apache (2.4.18)
       - nginx (1.8.1)
       - php (5.6.19)
-----> Installing dependencies...
       Composer version 1.0.0-beta1 2016-03-03 15:15:10
-----> Preparing runtime environment...
       NOTICE: No Procfile, using 'web: vendor/bin/heroku-php-apache2'.
-----> Checking for additional extensions to install...
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 13M
-----> Launching...
       Released v43
       https://<address>.herokuapp.com/ deployed to Heroku
  • 写回答

1条回答 默认 最新

  • doujing3896 2016-03-20 15:42
    关注

    OK found the issue and fixed.

    It seems that request header variables should not have underscores in them. This has only been highlighted since moving to Heroku.

    So in my situation APP_KEY was not visible to the code, changed to APPKEY and everything was fixed.

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用