使用自签名证书在Chrome android上远程调试Service Worker [英] Remotely debugging service worker on chrome android with self signed certificate

查看:158
本文介绍了使用自签名证书在Chrome android上远程调试Service Worker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试由我的开发机提供服务并在智能手机上的chrome android中运行的服务人员。

I was trying to debug a service worker served from my dev machine and running inside chrome android on the smartphone.

我正在使用usb连接并从我的开发机进行远程调试。服务人员仅在https中工作,我可以接受,chrome和firefox都拒绝注册软件。

I was using the usb connection and remotely debugging from my dev machine. The service worker works only in https and I can live with that, both chrome and firefox where refusing to register the SW.

然后,我在开发机上使用了自签名证书,该证书显然不受移动浏览器的信任。他们警告说证书不好,但是可以选择继续执行该证书。我单击是,尽管从那时起Firefox可以注册SW chrome,但仍在抱怨证书不好,因此拒绝注册SW。

Then I used a self signed certificate on my dev machine, which obviously was not trusted by the mobile browsers. They warned the certificate was not good but gave the option to proceed with that certificate. I clicked yes and, while firefox from that point was able to register the SW chrome was still compaining that the certificate was not good and refused to register the SW.

我试图将自签名的CA包括在智能手机信任列表中,但没有找到解决方法。最后,我必须使用正式证书从生产服务器提供该应用程序,这是我根本不喜欢的,但我不能在这一问题上浪费一整天。

I tried to include the self signed CA in the smartphone trust list but didn't find a way to do that. In the end I had to serve the app from a production server with a regular certificate, which I didn't like at all, but I could not waste a whole day on this issue.

如何通过LAN中的开发机远程调试Android上的服务人员?本地主机不能使用,因为它们是2个单独的设备。我找到了一个忽略Chrome的https警告的设置,但使用的是台式机版本,我使用的是android chrome,如何禁用此无聊的阻止错误?

How is it possible to remote debug a service worker on android served from a dev machine in a LAN? localhost cannot be used because they are 2 separate devices. I found a setting to ignore the https waring for chrome but desktop version, I am using android chrome, how can I disable this boring blocking error?

谢谢

推荐答案

我也面临着同样的问题。我已经书面服务人员为我的个人使用推送通知。当我在本地主机上运行时,它可以在我的桌面浏览器上完美运行。但是我想要在移动设备上进行通知,所以我尝试了许多选项来实现相同的目的,例如在移动设备上以本地主机的身份运行远程IP,USB调试,添加ssl证书和许多其他技巧,但对我没有任何帮助。但是后来,适用于android mobile的 Kick Web Server应用得到了救助,只花了几分钟就可以使用 localhost 在移动浏览器上运行我的应用并注册服务工作者。因此,不再需要SSL和USB调试。

I was also facing same issue. I have written service worker for push notification for my personal use. It was running perfectly on my desktop browser as I was running it on localhost. But I wanted notification on mobile so I tried many options to accomplish same, Running remote IP as localhost on mobile, USB debugging, adding ssl certificates and many other hacks but nothing worked for me. But then "Kick Web Server" app for android mobile came to my rescue, It took only few minute to run my application on mobile browser with localhost and register service worker. So no need of SSL and USB debugging any more.


步骤




  • 转到playstore并搜索 Kick Web Server应用(注意:在搜索结果后,将显示 Web Server PHPMyAdmin / MySql 带有这样的图标)。

  • 不要害怕你不需要使用此应用程序的PHP或Mysql,您可以轻松编写任何技术堆栈中的网站。

  • 打开应用程序,它将要求您授予访问存储的权限,您必须

  • 返回应用程序并单击停止按钮以启动Web服务器。

  • 它将在以下位置创建名为htdocs的目录/文件夹您的移动存储。

  • 从htdocs目录中删除现有内容(两个现有文件)。

  • 使用htdocs目录中的index.html复制构建内容。

  • 访问 http:// localhost:8080 在您的移动浏览器中,您将看到您的网站已启动并且正在运行,并且已注册服务工作者。

    • Goto playstore and search for "Kick Web Server" app (Note: after serching results will show "Web Server PHPMyAdmin/MySql" with icon like this).
    • Do not afraid you do not need PHP or Mysql with this app, you can run your web site with ease written in any technology stack.
    • Open app it will ask you for permission to access storage, you have to grant permission to it.
    • Get back to app and click on stopped button to start web server.
    • It will create directory/folder named htdocs in your mobile storage.
    • Delete existing content(two existing files) from htdocs directory.
    • Copy content of your build with index.html in htdocs directory.
    • Visit http://localhost:8080 in your mobile browser and you will see your site is up and running with service worker registered.
    • 这篇关于使用自签名证书在Chrome android上远程调试Service Worker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆