https://github.com/mtjddnr/lab/wiki/Xcode-Integration-Server-OTA---反向代理-Nginx
Nginx + 反向代理 + OS X 服务器[Xcode 服务器]
Setup
互联网 -> [443] 路由器(端口转发) -> [443]Nginx 服务器(有 HTTPS 证书) -> [443]Mac Mini(OS X 服务器、Xcode 服务器)
(StartSSL certificate is used)
Xcode Server 使用 20300(HTTP)、20343(HTTPS) 端口
Problem
- 进入Xcode服务器WEB
- 选择机器人
- hit
Install
button
- 如果是第一次,它会要求安装证书。安装它并返回网页。
- hit
Install
再次按钮
- 警报消息“无法连接到服务器”
OTA 的工作原理
- 当被击中时
Install
按钮,它会导航到https://<DOMAIN>/xcode/internal/api/integrations/<UNIQUE ID>/install_product
- 它将状态 302 返回到新位置:
itms-services://?action=download-manifest&url=https://<DOMAIN>:20343/api/integrations/<UNIQUE ID>/<RECENT Integrated ID>/install_manifest.plist
-
itms-services
URL Schema 调用 iOS 设备来运行安装。
- iOS 下载
install_manifest.plist
然后根据plist信息,选择正确的IPA
URL
https://<DOMAIN>:20343/api/assets/token/<RECENT Integrated ID>/<UNIQUE ID>-<Bot Name>/<Intergation #>/<Product Name>-<Device Model>.ipa
- 下载并安装
Analysis
- 在第 2 步,它返回 URL
<DOMAIN>:20343
。路由器(或防火墙)未打开端口号 20343
- 路径也应该是
/xcode/internal/api/integrations/
not /api/integrations/
怎么修
地点:/Library/Developer/XcodeServer/CurrentXcodeSymlink/Contents/Developer/usr/share/xcs/xcsd/
Modify constants.js
Line 25
XCSProxiedAPIBasePath: '/xcode/api',
to
XCSProxiedAPIBasePath: '/xcode/internal/api',
Comment classes/fileClass.js
383路
//host = host.split(':')[0] + ':' + k.XCSHTTPSPort; // force traffic over the HTTPS port
Modify classes/fileClass.js
384线
var basePath = k.XCSAPIBasePath; // connection is direct to xcsd, always
to
var basePath = k.XCSProxiedAPIBasePath; // connection is direct to xcsd, always
Restart Server