简体   繁体   English

使用Trigger.io开发时如何使用自签名SSL证书?

[英]How to use a self-signed SSL certificate when developing with Trigger.io?

Our backend is in rails, and for several reasons the development environment has to be run with rails using a self-signed SSL certificate. 我们的后端位于Rails中,由于多种原因,必须使用自签名SSL证书在Rails中运行开发环境。 This works fine on the desktop after manually trusting the certificate. 手动信任证书后,这在桌面上可以正常工作。

Using Trigger.io, we're developing a mobile application targeting iOS from the same backend. 使用Trigger.io,我们正在从同一后端开发针对iOS的移动应用程序。 It would be ideal for us to be able to run the rails server with SSL (so we can compare the browser output) and still have the iOS simulator connect properly without complaining about invalid certs. 对于我们来说,理想的是能够使用SSL运行Rails服务器(以便我们可以比较浏览器输出),并且仍然可以正确连接iOS模拟器,而不会抱怨证书无效。

Production is using a proper ssl-cert, but what's the best way to set up the simulator? 生产使用的是正确的ssl证书,但是设置模拟器的最佳方法是什么?

You can try installing the CRT file on the device like this: 您可以尝试像这样在设备上安装CRT文件:

This is similar to how you could debug SSL with proxy as described here 这类似于描述你可以如何调试与代理SSL 这里

For testing purposes, you can create a category around NSURLRequest that ignores certificates: 为了进行测试,您可以在NSURLRequest周围创建一个类别,该类别将忽略证书:

@implementation NSURLRequest (IgnoreSSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host
{
  return YES;
}
@end

This obviously can't be submitted to the app store, and shouldn't be used in production. 这显然不能提交到应用商店,也不应该在生产中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM