【问题标题】:Error 400 Bad Request when deploying Api Platform on Heroku在 Heroku 上部署 Api 平台时出现错误 400 Bad Request
【发布时间】:2021-06-29 09:21:23
【问题描述】:

V2.6.5

在 Heroku 上部署 API 后请求 API 时,我面临 400 错误错误请求。但我不知道为什么?

我做了什么:

  • 在 /api 的根目录中添加了 Procfile

  • 在 /api/public 中添加 .htaccess(通过 composer require symfony/apache-pack 命令)

  • 在 Heroku Dashboard 应用设置中定义了 APP_ENV 和 DATABASE_URL

  • 在 Heroku Dashboard 上添加了 Postegresql 插件

  • 在 /api 文件夹中: git init >> git add 。 >> git commit -m "..." >> heroku create >> git push heroku master

  • 通过邮递员向 /greetings 端点发送 GET http 请求(响应 400 代码错误)

这是一个全新的api项目,除了上面描述的步骤,我什么都没做。

(一开始我是按照官方api平台文档中的教程使用app.json manifest但没有考虑到,所以我直接在heroku的dashboard中进行了配置)

【问题讨论】:

    标签: symfony heroku api-platform.com


    【解决方案1】:

    在 Procfile 上,只需删除引号 ''

    之前:'web: heroku-php-apache2 public/'

    之后:web: heroku-php-apache2 public/

    也许你应该尝试: /api/问候/

    【讨论】:

    • 感谢您的回答。我没有在 Procfile 中加上引号,但它不起作用:/
    猜你喜欢
    • 2014-03-20
    • 2015-11-16
    • 2011-05-31
    • 1970-01-01
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 2023-01-03
    • 2012-01-18
    相关资源
    最近更新 更多