arquivo / pwa-technologies

Arquivo.pt main goal is the preservation and access of web contents that are no longer available online. During the developing of the PWA IR (information retrieval) system we faced limitations in searching speed, quality of results, scalability and usability. To cope with this, we modified the archive-access project (http://archive-access.sourceforge.net/) to support our web archive IR requirements. Nutchwax, Nutch and Wayback’s code were adapted to meet the requirements. Several optimizations were added, such as simplifications in the way document versions are searched and several bottlenecks were resolved. The PWA search engine is a public service at http://archive.pt and a research platform for web archiving. As it predecessor Nutch, it runs over Hadoop clusters for distributed computing following the map-reduce paradigm. Its major features include fast full-text search, URL search, phrase search, faceted search (date, format, site), and sorting by relevance and date. The PWA search engine is highly scalable and its architecture is flexible enough to enable the deployment of different configurations to respond to the different needs. Currently, it serves an archive collection searchable by full-text with 180 million documents ranging between 1996 and 2010.
http://www.arquivo.pt
GNU General Public License v3.0
38 stars 7 forks source link

Framed replay displays a recursive frame on some publico.pt archived webpages #1306

Open VascoRatoFCCN opened 1 year ago

VascoRatoFCCN commented 1 year ago

When trying to view https://arquivo.pt/wayback/20220916102735/https://www.publico.pt/ , after a while the replay breaks:

image

However, the replay works properly if we view it without a frame (https://arquivo.pt/noFrame/replay/20220916102735/https://www.publico.pt/).

VascoRatoFCCN commented 1 year ago

Tested on latest pywb version (2.7.4), problem still happens.

VascoRatoFCCN commented 1 year ago

This is most likely caused by a faulty rewrite by wombat. Inspecting the network activity, it seems to be related to a google tag manager (GTM) request, it is the only place where the new URL is shown:

image

This is the relevant part of the archived GTM reply (omitted parts of the reply were replaced by /* ... */ ):

// Copyright 2012 Google Inc. All rights reserved.
(function(w, g) {
    w[g] = w[g] || {};
    w[g].e = function(s) {
        return eval(s);
    }
    ;
}
)(window, 'google_tag_manager');
(function() {

    var data = {
        "resource": {
            "version": "1611",
            "macros": [ /* ... */ ],
            "tags":[{
/* ... */
            }, {
                "function": "__html",
                "metadata": ["map"],
                "once_per_event": true,
                "vtp_html": "\u003Cscript type=\"text\/gtmscript\"\u003Efetch(\"https:\/\/static.publico.pt\/files\/widgets\/minimarcas\/minimarcas.html?v2110150203112133\").then(function(a){200==a.status\u0026\u0026a.text().then(function(b){$(\"body\").append(b)})});\u003C\/script\u003E",
                "vtp_supportDocumentWrite": false,
                "vtp_enableIframeMode": false,
                "vtp_enableEditJsMacroBehavior": false,
                "tag_id": 314
            }, {
/* ... */

After rendering the vtp_html field, it seems to be a GTM script that makes a request to https://static.publico.pt/files/widgets/minimarcas/minimarcas.html and then injects the reply onto the document's body:

<script type="text/gtmscript">
    fetch("https://static.publico.pt/files/widgets/minimarcas/minimarcas.html?v2110150203112133")
    .then(function(a){
        200==a.status&&a.text().then(function(b){
            $("body").append(b)
        })
    });
</script>

My guess is that since this GTM script is being injected at runtime, it is not properly rewritten by wombat, which causes this issue.