mardi 31 décembre 2019

Firebase Dynamic Link attempts to open non-existing URI (/_/DurableDeepLinkUi/csreport)

We use Firebase Dynamic Links to generate short links that are sent via SMS and email.

A few notes:

  • These short links are not linked to an app
  • They are only intended to open a browser page

With that said, our infrastructure monitoring is indicating 404 errors on a strange URL: /_/DurableDeepLinkUi/cspreport

The strongest indicator that this is related to the Short Link is the fact that the long URL of our short link is in the request.headers.referer of the error stack.

Here are the error attributes and the error message:

Uncaught exception 'CHttpException' with message 'Unable to resolve the request "_/DurableDeepLinkUi/cspreport".'

url                             /_/DurableDeepLinkUi/cspreport
httpResponseCode                404
request.headers.User-Agent      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
request.headers.contentLength   501
request.headers.host            
request.headers.referer         
request.headers.contentType     application/csp-report
request.method                  POST
response.headers.contentType    text/html

Here's an excerpt of how we generate our Dynamic Short Links:

$request_url = "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=" . $api_key;

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => $request_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
        "dynamicLinkInfo" => [
            "domainUriPrefix" => $short_uri_prefix,
            "link" => $long_url,
            "androidInfo" => [
                "androidFallbackLink" => $long_url
            ],
            "iosInfo" => [
                "iosFallbackLink" => $long_url
            ],
            "navigationInfo" => [
                "enableForcedRedirect" => false
            ]
        ],
        "suffix" => [
            "option" => "SHORT"
        ]
    ]),
    CURLOPT_HTTPHEADER => [
        "Cache-Control: no-cache",
        "Content-Type: application/json",
    ],
]);

$response = curl_exec($curl);

Any idea what might be causing this 404? We have not been able to reliably reproduce it on any Android or iOS device we have internally.

We've reviewed the documentation provided by Google on this topic, to no avail: https://firebase.google.com/docs/reference/dynamic-links/link-shortener




Aucun commentaire:

Enregistrer un commentaire