如何在角度项目上将所有HTTP请求重定向到HTTPS? [英] How to redirect all HTTP requests to HTTPS on a angular project?

查看:119
本文介绍了如何在角度项目上将所有HTTP请求重定向到HTTPS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置了app.yaml文件,如下所示,当我正在尝试将项目作为http:// localhost:8080时,项目lodes没有重定向到

https:// localhost(甚至页面未在本地开发中加载为https)网址应将正常请求更改为https:// ....



我所做的是将以下部分添加到.yaml



I have configure the app.yaml file as below and when i'm trying the project as http://localhost:8080 the project lodes without redirecting to
https://localhost (even the page not loading as https on local development) the url should change normal requests to https://....

what i did is adding the below part to .yaml

secure: always
  redirect_http_response_code: 301





如何解决这个问题?



我尝试过的事情:





how to resolve this?

What I have tried:

handlers:

- url: /(.*)
  static_files: dist/index.html
  upload: dist/index.html
  secure: always
  redirect_http_response_code: 301

推荐答案

它正在运行,我必须为我们上传它test live on live,因为https重定向不在本地开发环境下工作。
It's working , i had to upload it for our test serve on live , because https redirection in not working under the local development environment.


这篇关于如何在角度项目上将所有HTTP请求重定向到HTTPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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