简体   繁体   English

我无法禁用Google App Engine的http请求

[英]I can't disable http requests for my Google App Engine

I created a Nodejs/Express API app and uploaded to Google App Engine. 我创建了一个Nodejs / Express API应用,并将其上传到Google App Engine。

It works fine. 工作正常。

But it accepts HTTP (not-secure) requests and HTTPS. 但是它接受HTTP(非安全)请求和HTTPS。

I tried to disable the HTTP requests with the following config: 我尝试使用以下配置禁用HTTP请求:

// app.yaml

runtime: nodejs
env: flex

handlers:
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

Even after the new upload of the project, it still accepts HTTP requests and not redirects to HTTPS. 即使在新上传项目后,它仍会接受HTTP请求,并且不会重定向到HTTPS。

What I'm doing wrong? 我做错了什么?

(I don't want to use a custom domain, just the my-project.appspot.com ). (我不想使用自定义域,仅使用my-project.appspot.com )。

App Engine Flexible doesn't support using options like secure and redirect_http_response_code as stated in the official docs in the app.yaml file. App Engine Flexible不支持使用app.yaml文件中的官方文档中所述的secureredirect_http_response_code类的选项。

My suggestion would be either move this application that you have to the Standard environment, which now supports Node and has these features that you want to use, or to manually do the redirection in your code. 我的建议是将您拥有的该应用程序移动到现在支持Node并且具有要使用的这些功能的Standard环境中,或者手动在代码中进行重定向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM