简体   繁体   中英

HTTPS and CORS with Sony Camera API

I am developing a web application which makes use of the Sony Camera API with an Alpha 6300.

The web-app needs to access the camera and internet at the same time. Therefore, I am using a laptop with two network adapters, one connecting to Wi-Fi and one to the camera access point. I got this to work without the discovery phase, which is not possible from a browser (that's ok, the IP address of the camera is always the same).

However, in order to get it working on the production server (which is secure), I need some ugly hacks, due to the camera endpoints being only available in HTTP (no HTTPS) and with no CORS headers:

  • I need to use a Chrome extension to bypass CORS
  • I need to click on 'load unsafe scripts' in Google Chrome

A quick solution would be to pack everything in an Electron app, thus overriding Chrome's (more than legitimate) security concerns. However, this would strongly complicate the deploying and testing process. I would rather go with a web-based solution, if possible.

Anybody knows if there's a way to enforce HTTPS and set Access-Control-Allow-Origin on the Camera server?

You can use a local CORS proxy. That's what I've done for development.

I went the similar route of "Electron" for disabling the same origin policy, only I used PhoneGap because I needed this for a phone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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