论坛架设好之后,web端访问ok,但是anroid端访问无反应

By oychw at 2017-10-30 • 0人收藏 • 3271人看过

论坛架设好之后,web端访问ok,但是anroid端访问无反应,服务器端能看到android的access,但是android端报网络错误,抓包看到的访问的地址是:/和/page/1。目前用得是HTTP,是不是一定要HTTPS?

有碰到类似问题的么,谢谢!

7 个回复 | 最后更新于 2017-11-01
2017-10-30   #1

如果你做了HTTP 301 HTTPS,那必须的用HTTPS了。

2017-10-30   #2

不一定要https,你可以在API设置里自行设置为http。

2017-10-31   #3

测试安卓客户端okhttp重构

2017-10-31   #4

安卓端的api设置如下:

    public static final String DOMAIN_NAME = "http://123.207.97.109" + WEBSITE_PATH; // Main domain name
    public static final String MOBILE_DOMAIN_NAME = "http://123.207.97.109" + WEBSITE_PATH; // Domain name of mobile version
    public static final String BASIC_API_URL = "http://123.207.97.109" + WEBSITE_PATH; // Domain name of API

但是访问不了,是不是安卓端无法处理302?


手机端抓包看到服务器端是有返回的:


返回内容:

HTTP/1.1 302 Found
Date: Tue, 31 Oct 2017 08:20:21 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.0.25
X-Powered-By: PHP/7.0.25
X-Frame-Options: SAMEORIGIN
Set-Cookie: CarbonBBS_View=mobile; path=/; HttpOnlylocation: /
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
200 OK
Date: Tue, 31 Oct 2017 08:20:21 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.0.25
X-Powered-By: PHP/7.0.25
X-Frame-Options: SAMEORIGIN
Set-Cookie: CarbonBBS_View=mobile; path=/; HttpOnlyX-Response-Time: 1.334ms
Content-Length: 5888
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
 <head> 
  <title>Carbon Forum</title> 
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
  <meta http-equiv="Cache-Control" content="no-siteapp" /> 
  <meta http-equiv="cleartype" content="on" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" /> 
  <meta name="MobileOptimized" content="320" /> 
  <meta name="HandheldFriendly" content="True" /> 
  <meta name="apple-mobile-web-app-capable" content="yes" /> 
  <meta name="mobile-web-app-capable" content="yes" /> 
  <meta name="full-screen" content="yes" /> 
  <meta name="browsermode" content="application" /> 
  <meta name="x5-fullscreen" content="true" /> 
  <meta name="msapplication-TileColor" content="#0088D1" /> 
  <meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" /> 
  <meta name="theme-color" content="#0088D1" /> 
  <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" /> 
  <link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" /> 
  <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" /> 
  <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" /> 
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" /> 
  <link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" /> 
  <link rel="shortcut icon" type="image/ico" href="/favicon.ico" /> 
  <link rel="stylesheet" type="text/css" href="/static/css/mobile/appframework.css?version=5.9.0" /> 
  <link rel="stylesheet" type="text/css" href="/static/css/mobile/style.css?version=5.9.0" /> 
  <link rel="search" type="application/opensearchdescription+xml" title="Carbon Forum" href="/search.xml" /> 
  <script type="text/javascript">        var Prefix="carbon_";        var WebsitePath="";    </script> 
  <script type="text/javascript" charset="utf-8" src="/static/js/jquery.js"></script> 
  <script type="text/javascript" charset="utf-8" src="/static/js/mobile/appframework.ui.min.js?version=5.9.0"></script> 
  <script type="text/javascript" charset="utf-8" src="/static/js/mobile/global.js?version=5.9.0"></script> 
  <script type="text/javascript" charset="utf-8" src="/language/zh-cn/global.js?version=5.9.0"></script> 
  <meta name="description" content="一个精简、高速的基于话题的新式论坛" />
 </head>
 <body> 
  <!-- this is the main container div.  This way, you can have only part of your app use UI --> 
  <div id="mainview" class="view splitview"> 
   <header> 
    <h1>Carbon Forum</h1> 
    <a onclick="javascript:slideout.toggle();"></a> 
   </header> 
   <div> 
    <div data-title="Carbon Forum" id="IDebbfb2d106d79eb7697e68f0152c1ca3" selected="true"> 
     <ul class="list topic-list"> 
      <li> 
       <div> 
        <a href="/u/xurongzhong" data-transition="slide"> <img src="/upload/avatar/middle/1.png" alt="xurongzhong" /> </a> 
       </div> 
       <div> 
        <a href="/t/1" data-transition="slide" data-refresh="true"> <h2>Zelin论坛开通了</h2> </a> 
        <p>3&nbsp;天前&nbsp;&nbsp; </p> 
       </div> 
       <div></div> </li>
     </ul> 
    </div> 
   </div> 
   <!-- this is the default left side nav menu.  If you do not want any, do not include these --> 
   <nav id="menu"> 
    <div class="view active" id="navView"> 
     <header id="menuHeader"></header> 
     <div> 
      <div class="panel active" id="navPage" style="padding:0!important;" data-title="navPage"> 
       <ul> 
        <li> <a class="icon home" href="/" data-transition="slide" data-refresh="true">首页</a> </li> 
        <li> <a class="icon pin" href="/tags" data-transition="slide">话题广场</a> </li> 
        <li> <a class="icon question" href="JavaScript:Search();" data-transition="slide">搜索</a> </li> 
        <li> 登 录 </li> 
        <li><a class="icon new" href="javascript:$('#LoginViewCancelButton').text(Lang['Cancel']);$.afui.loadContent('#LoginPanel', false, false, 'up-reveal',$('#mainview'));"> 登 录 </a></li> 
        <li><a class="icon new" href="/register" data-transition="slide">现在注册</a></li>
       </ul> 
      </div> 
     </div> 
    </div> 
   </nav> 
  </div> 
  <div id="LoginView"> 
   <div> 
    <div id="LoginPanel"> 
     <p> <br /> </p>
     <h1> 登 录 </h1> 
     <br /> 
     <p></p> 
     <form action="/login" method="post" onsubmit="JavaScript:this.Password.value=md5(this.Password.value);"> 
      <div> 
       <input type="hidden" value="/" name="ReturnUrl" id="ReturnUrl" /> 
       <input type="hidden" name="FormHash" value="c5ff8004" /> 
       <input type="hidden" name="Expires" value="30" /> 
       <p> <input type="text" name="UserName" id="UserName" placeholder="用户名" value="" /> </p> 
       <p> <input type="password" name="Password" id="Password" placeholder="密码" value="" /> </p> 
       <p> <input type="text" name="VerifyCode" id="VerifyCode" placeholder="验证码" onclick="document.getElementById('Verification_Code_Img').src='/seccode.php';" value="" style="width:66%;" /> <img src="" id="Verification_Code_Img" style="width:33%;" onclick="this.src+=''" /> <br style="clear:both" /> </p> 
       <p> <a href="/register">现在注册</a> <input type="submit" value=" 登 录 " name="submit" style="float:right;" /> </p> 
       <p> </p> 
       <p><a class="button block" href="#main" data-transition="up-reveal:dismiss" id="LoginViewCancelButton"></a></p> 
      </div> 
     </form> 
    </div> 
   </div> 
  </div> 
 </body>
</html>


2017-10-31   #5

回复#4 @oychw :

302是可以处理的。

问题在于你没设置API使用的域名。

blob.png

2017-10-31   #6

回复#4 @oychw :

你API请求的也还是PC端的HTML页面,而不是我设置的接口。

2017-11-01   #7

安卓端ok了,谢谢!


登录后方可回帖

登 录
信息栏

Carbon Forum是一个基于话题的高性能轻型PHP论坛

下载地址:Carbon Forum v5.9.0
QQ群:12607708(QQ我不常上)

donate

手机支付宝扫描上方二维码可向本项目捐款

粤公网安备 44030602003677号
粤ICP备17135490号

Loading...