Angular POST请求保护

时间:2019-02-11 03:51:00

标签: angular security post angular-httpclient

我是新来的有角度的人,下面有问题请帮忙。如果我从Angular代码向第三方API发出POST请求,如何确保我的POST请求数据不会被其他黑客入侵和操纵。

1 个答案:

答案 0 :(得分:1)

大多数http://个发布请求更容易受到发布请求中发送的黑客数据的攻击。为了确保安全,您需要通过https://

发送数据

在angular中,您可以使用以下代码拦截HTTP请求并使其安全。

// clone request and replace 'http://' with 'https://' at the same time
const secureReq = req.clone({
  url: req.url.replace('http://', 'https://')
});
// send the cloned, "secure" request to the next handler.
return next.handle(secureReq);

DATETIME_INPUT_FORMATS

希望这会有所帮助!