【发布时间】:2021-11-03 13:50:59
【问题描述】:
我在 Google App Engine 上部署了一个包含 2 个服务的 PHP 应用程序:admin 和 api。
我使用配置文件来路由请求。
我的问题是我无法将请求路由到我的服务。只使用默认值。
结构如下:
|-- admin
|-- public
|-- index.php
|-- admin.yaml
|-- API
|-- api
|-- index.php
|-- api.yaml
|-- dispatch.yaml
|-- index.php
dispatch.yaml:
dispatch:
# Send all api traffic to the API.
- url: "*/API/api/*"
service: api
# Send all admin traffic to the admin.
- url: "*/admin/public/*"
service: admin
# Default service serves simple hostname request.
- url: "*/*"
service: default
admin/admin.yaml:
runtime: php73
service: admin
handlers:
- url: /admin/public/.*
script: /admin/public/index.php
API/api.yaml:
runtime: php73
service: api
handlers:
- url: /API/api/.*
script: /API/api/index.php
index.php:echo "Not found";
admin/public/index.php:echo "Welcome to admin service";
API/api/index.php:echo "Welcome to api service";
当我发送请求:https://SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com 或 https://PROJECT_ID.REGION_ID.r.appspot.com 时,响应是预期的:未找到。
但是当我发送请求时:https://SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com/API/api/ 或 https://PROJECT_ID.REGION_ID.r.appspot.com/API/api/ 响应是 error code 500 而不是:Welcome to api service。
有什么问题?配置 ?请求网址?其他?
【问题讨论】:
-
您还可以从您的应用中添加logs 吗?