I'm trying to add an image to a collection from Google Storage. Since the image is not publicly accessible from Cloud Storage, I can't link to it directly. Instead, I make the GCS API call to generate a signed URL (which expires after a short while) and send that to Wikitude. Unfortunately, Wikitude doesn't seem to handle it properly:
$ curl -v -H 'Content-Type: application/json' -H 'X-Version: 3' -H 'X-Token: my-manager-token' -d '{"imageUrl": "https://storage.googleapis.com/lifeprint2-1222.appspot.com/296fa09c%2F296fa09c945d53af583eea822b2b81adeba0a62e.jpg?Expires=1463239340&GoogleAccessId=lifeprint2-1222%40appspot.gserviceaccount.com&Signature=Y2wNM9lu2MWorpgNGS5ba55Irmu8%2BU2682x0NLMpOabkbBhrr%2FD8aafxsNRjNxS4L4MthrZM8LGVv8CM9smVIqqTTcR6va2rRJzFIGUS8vVQXKEaCdWpSICBEeZ5a6AH7Vvrq4OEZWQVP%2FGUY4uuWY50dLRcIcuTL16U7hmPAE4in1T6bbVeTq7oPjgzRzFwCBcTkvklr7Qn3ANCnPpwqGCn6Nn3TsTKpkk13gtRWMgLL%2FcDbd5Ei6SLEMDTZTYSleTnId7zTMeGcrfC9PAQcy%2FtVCJU8SysvoHEKucA4D0n14NM4wqmRdEoG0n2YPpCKAqgkCBPX%2FYEpVifGD8nBQ%3D%3D", "name": "corridor"}' https://api-us.wikitude.com/cloudrecognition/targetCollection/my-collection-id/target * Trying 52.72.232.11... * Connected to api-us.wikitude.com (52.72.232.11) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: *.wikitude.com * Server certificate: thawte SSL CA - G2 * Server certificate: thawte Primary Root CA > POST /cloudrecognition/targetCollection/my-collection-id/target HTTP/1.1 > Host: api-us.wikitude.com > User-Agent: curl/7.43.0 > Accept: */* > Content-Type: application/json > X-Version: 3 > X-Token: my-manager-token > Content-Length: 601 > * upload completely sent off: 601 out of 601 bytes < HTTP/1.1 502 Proxy Error < Date: Wed, 11 May 2016 15:25:23 GMT < Server: Apache/2.4.7 (Ubuntu) < Access-Control-Allow-Headers: X-Requested-With, Origin, Client-Security-Token, Accept-Encoding, Content-Type, Authorization, Accept, X-Version, X-Api-Token, X-Token, X-Horizontal-FOV, X-Requested-Authentication-Strategy, Location, X-HTTP-Method-Override < Access-Control-Expose-Headers: Location, X-Authenticated-Account < Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS < Access-Control-Allow-Credentials: true < Cache-Control: no-store < Content-Length: 595 < Content-Type: text/html; charset=iso-8859-1 < <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>502 Proxy Error</title> </head><body> <h1>Proxy Error</h1> <p>The proxy server received an invalid response from an upstream server.<br /> The proxy server could not handle the request <em><a href="/cloudrecognition/targetCollection/my-collection-id/target">POST /cloudrecognition/targetCollection/my-collection-id/target</a></em>.<p> Reason: <strong>Error reading from remote server</strong></p></p> <hr> <address>Apache/2.4.7 (Ubuntu) Server at api-us.wikitude.com Port 443</address> </body></html> * Connection #0 to host api-us.wikitude.com left intact $
(I've obscured the collection id and my token.)
What do you suggest I do? I can make the same call for public image on Google Cloud Storage just fine (it has a shorter URL -- there's no other difference). The signed URL for private content is around 560+ bytes; is that too long?
Thanks,
Faried.
A
Andreas Fötschl
said
about 7 years ago
Hi there! The length of the url shouldn't be an issue but please ensure to solely use publicly available ressources as url-attribute. The asset is downloaded in default way without any special implementation. You may e.g. first download protected files to a public directory on your server and use this url then as target-upload url.
Faried