V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Lin1998
V2EX  ›  问与答

求助: Angular iPhone / iPad post 请求失败

  •  
  •   Lin1998 · Apr 21, 2020 · 1501 views
    This topic created in 2200 days ago, the information mentioned may be changed or developed.

    #大佬们 帮帮忙

    Angular 发送 post 请求时在 iPhone 和 iPad 出现错误 Android, Windows 和 Mac 运行正常.

    后端头部(php):

    header('Access-Control-Allow-Origin:*');

    header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS,PATCH');

    header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');

    header('Access-Control-Allow-Credentials: true');

    请求代码如下:

    this.http.post('https://example/login', data); //data 是个 Json

    如果发送空 Json iPhone 和 iPad 照样失败 空 Json 代码如下

    this.http.post('https://example/login', {});

    以上两种方式 好像没有发送直接失败, 因为后端那边没有收到请求

    但是下面这样的请求运行正常

    this.http.post('https://example/login', "text");

    在本地测试时一切正常, 线上测试时 iPhone 和 iPad 出现了这种状况

    个人认为是 ios 认为请求不够安全所有直接拒绝 但是后端有 SSL 认证(虽然是 DV 级)

    要怎么样才能在 iPhone 和 iPad 上用 post 发送 Json 呢?

    第一次发帖 如果哪里不详细 请大佬们指点 万分感谢 谢谢 谢谢 谢谢

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5567 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 03:09 · PVG 11:09 · LAX 20:09 · JFK 23:09
    ♥ Do have faith in what you're doing.