【问题标题】:Which Path should I use in my website? Related path absolute path? [closed]我应该在我的网站中使用哪个路径?相关路径绝对路径? [关闭]
【发布时间】:2020-09-19 07:05:08
【问题描述】:

我正在为我的客户建立网站。我想知道我的网站应该使用哪个路径?哪条路径更安全?如果我完全错了,或者您有其他网站安全问题的原因,也请纠正我!提前致谢。

例如...

<script src="https://example.com/admin/js/myjavascript.js"></script>
or
<script src="/js/myjavascript.js"></script>

<img src="https://swadtiffin.ca/wp-content/uploads/myimg.jpg" alt="Loading...!">
or
<img src="/wp-content/uploads/myimg.jpg" alt="Loading...!">

$http({
  method: 'POST',
  url: '/wp-content/themes/astra-child/php/get_all_food_combos.php',
  data: $.param({ 'data': "test" }),
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  }).then(function (resp) {
  console.log(resp.data); //all items
  });
  }, function (error) {
     console.log(error);
  });

or

$http({
  method: 'POST',
  url: 'https://example.com/wp-content/themes/astra-child/php/get_combos.php',
  data: $.param({ 'data': "test" }),
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  }).then(function (resp) {
  console.log(resp.data); //all items
  });
  }, function (error) {
     console.log(error);
  });

【问题讨论】:

    标签: javascript html web path


    【解决方案1】:

    两种方式都可以。安全也不例外。但在不同的场景中使用。

    • 如果您为服务添加 URL 前缀。 (https://example.com/wp-content/...php) 这意味着您只能从此 URL 获取数据。如果你有服务在另一个网站上运行,你必须这样做。

    • 如果您不添加前缀,它将自动使用本地路径中的服务。

    【讨论】:

      【解决方案2】:

      正如 Anukul 在本案中提到的,两者都可以。

      URI 路径通常不会影响应用程序的安全性。这是一个偏好和遵循标准的问题。

      在确定路径时需要考虑以下几点:

      1. 是否有敏感数据?

        如果是这样,请不要使用路径参数或查询 发送此敏感数据的参数。如果可能,请使用请求 带有 SSL/TLS 的 POST 中的有效负载。

      2. GET 方法通常记录在服务器日志中。

        在这种情况下使用参数可以吗?

      【讨论】:

        猜你喜欢
        • 2018-09-17
        • 1970-01-01
        • 2012-01-11
        • 2010-09-15
        • 2013-04-17
        • 2011-06-15
        • 2011-02-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多