重定向到https无法通过Android API休息调用

时间:2016-07-05 05:35:21

标签: android .htaccess http https url-rewrite-module

我正在将我的网站http设为https(使用letsencrypt certificate),并将http从http重定向到以下网址:

RewriteEngine on
RewriteCond %{SERVER_NAME} =xyz.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

我正在从我的android代码中调用我的网站url http API,但它失败了。当我将其更改为https时,才会成功。为什么会发生这种情况,并且有一种方式可以使我的android代码中的http调用本身成功。

1 个答案:

答案 0 :(得分:1)

我的建议:

  • 始终在Android代码中指定https

  • 对于API,请勿重定向http-> https,但在http版本上回答错误,它有助于更​​快地捕获安全错误(重定向可能无法检测到)