Saving / Upload only works every second time

Aloha,

this drives me nuts – mainly because I assume this is absolutely my or my servers fault: Every time I create a new page and save it or edit an existing page and save it or I upload a file via drag-n-drop the first time it doesn’t work and the white progress bar takes for ever and actually never finishes. If I do the same thing a second it works.

Same for logging in: first time nope, second time fine.

I am on Toolkit / Kirby / Panel 2.3.2 and desperately need any hint how debug this and find the cause of this odd behavior.

A million thanks in advance, Yves

Do you use any hooks or plugins?

No hooks, but these Plugins:

  • Cachebuster
  • Feed
  • Guggenheim
  • Map
  • Relative-date

I’ve read something about Cachebuster plugin being problematic. Do you need URLs for the above mentioned plugins?

An easy way to see if cachebuster is causing the issue is to disable it and see if your issue still occurs.

Are you using the latest version of the cachebuster plugin?

I’d try to disable/remove all plugins one by one to see which might be causing this. It’s probably likely a field is causing this as the issue appears in the panel.

Even with all plugins (moved outside the /plugins folder and disabled in config.php) disabled and the original .htaccess restored the creeping progress bar without save success is still a thing. Not every second time but often enough to make me sad.

Does this happen in any browser?

For now it happens mainly on Safari (9.1.2). I used the panel with Firefox for most of the day and so far the described problems never occurred. Maybe some interactions with Safari’s content blockers? I’ll check this.

If you find anything, could you pls. report your findings here?

Maybe it’s your browser cache? Could you please try clearing it in Safari?

So upon some further diggin the problems doesn’t seem to be related to the browser used, but are due to some common caching directives I’ve added to .htaccess:

# ######################################################################
# # MEDIA TYPES AND CHARACTER ENCODINGS                                #
# ######################################################################

# ----------------------------------------------------------------------
# | Media types                                                        |
# ----------------------------------------------------------------------

# Serve resources with the proper media types (f.k.a. MIME types).
#
# https://www.iana.org/assignments/media-types/media-types.xhtml
# https://httpd.apache.org/docs/current/mod/mod_mime.html#addtype

<IfModule mod_mime.c>

  # Data interchange

    AddType application/atom+xml                        atom
    AddType application/json                            json map topojson
    AddType application/ld+json                         jsonld
    AddType application/rss+xml                         rss
    AddType application/vnd.geo+json                    geojson
    AddType application/xml                             rdf xml

  # JavaScript

    # Normalize to standard type.
    # https://tools.ietf.org/html/rfc4329#section-7.2

    AddType application/javascript                      js

  # Manifest files

    AddType application/manifest+json                   webmanifest
    AddType application/x-web-app-manifest+json         webapp
    AddType text/cache-manifest                         appcache

  # Media files

    AddType audio/mp4                                   f4a f4b m4a
    AddType audio/ogg                                   oga ogg opus
    AddType image/bmp                                   bmp
    AddType image/svg+xml                               svg svgz
    AddType image/webp                                  webp
    AddType video/mp4                                   f4v f4p m4v mp4
    AddType video/ogg                                   ogv
    AddType video/webm                                  webm
    AddType video/x-flv                                 flv

    # Serving .ico image files with a different media type
    # prevents Internet Explorer from displaying then as images:
    # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee

    AddType image/x-icon                                cur ico

  # Web fonts

    AddType application/font-woff                       woff
    AddType application/font-woff2                      woff2
    AddType application/vnd.ms-fontobject               eot

    # Browsers usually ignore the font media types and simply sniff
    # the bytes to figure out the font type.
    # https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern
    #
    # However, Blink and WebKit based browsers will show a warning
    # in the console if the following font types are served with any
    # other media types.

    AddType application/x-font-ttf                      ttc ttf
    AddType font/opentype                               otf

  # Other

    AddType application/octet-stream                    safariextz
    AddType application/x-bb-appworld                   bbaw
    AddType application/x-chrome-extension              crx
    AddType application/x-opera-extension               oex
    AddType application/x-xpinstall                     xpi
    AddType text/vcard                                  vcard vcf
    AddType text/vnd.rim.location.xloc                  xloc
    AddType text/vtt                                    vtt
    AddType text/x-component                            htc

</IfModule>

# ######################################################################
# # WEB PERFORMANCE                                                    #
# ######################################################################

# ----------------------------------------------------------------------
# | Compression                                                        |
# ----------------------------------------------------------------------

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping

    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types

         <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE application/json
        AddOutputFilterByType DEFLATE application/ld+json
        AddOutputFilterByType DEFLATE application/manifest+json
        AddOutputFilterByType DEFLATE application/rdf+xml
        AddOutputFilterByType DEFLATE application/rss+xml
        AddOutputFilterByType DEFLATE application/schema+json
        AddOutputFilterByType DEFLATE application/vnd.geo+json
        AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
        AddOutputFilterByType DEFLATE application/x-font-ttf
        AddOutputFilterByType DEFLATE application/x-javascript
        AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
        AddOutputFilterByType DEFLATE application/xhtml+xml
        AddOutputFilterByType DEFLATE application/xml
        AddOutputFilterByType DEFLATE font/eot
        AddOutputFilterByType DEFLATE font/opentype
        AddOutputFilterByType DEFLATE image/bmp
        AddOutputFilterByType DEFLATE image/svg+xml
        AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
        AddOutputFilterByType DEFLATE image/x-icon
        AddOutputFilterByType DEFLATE text/cache-manifest
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE text/javascript
        AddOutputFilterByType DEFLATE text/plain
        AddOutputFilterByType DEFLATE text/vcard
        AddOutputFilterByType DEFLATE text/vnd.rim.location.xloc
        AddOutputFilterByType DEFLATE text/vtt
        AddOutputFilterByType DEFLATE text/x-component
        AddOutputFilterByType DEFLATE text/x-cross-domain-policy
        AddOutputFilterByType DEFLATE text/xml
         </IfModule>

    <IfModule mod_mime.c>
        AddEncoding gzip              svgz
    </IfModule>

</IfModule>

# ----------------------------------------------------------------------
# | Expires headers                                                    |
# ----------------------------------------------------------------------

<IfModule mod_expires.c>

    ExpiresActive On
    ExpiresDefault                          "access plus 1 day"

  # Favicon (cannot be renamed!) and cursor images

    ExpiresByType image/vnd.microsoft.icon  "access plus 1 week"
    ExpiresByType image/x-icon              "access plus 1 week"

  # Data interchange

    ExpiresByType application/atom+xml      "access plus 1 hour"
    ExpiresByType application/rdf+xml       "access plus 1 hour"
    ExpiresByType application/rss+xml       "access plus 1 hour"
    ExpiresByType application/json          "access plus 0 seconds"
    ExpiresByType application/ld+json       "access plus 0 seconds"
    ExpiresByType application/schema+json   "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json  "access plus 0 seconds"
    ExpiresByType application/xml           "access plus 0 seconds"
    ExpiresByType text/xml                  "access plus 0 seconds"

  # HTML

    ExpiresByType text/html                 "access plus 0 seconds"

  # Media files

    ExpiresByType image/gif                 "access plus 1 month"
    ExpiresByType image/ico                 "access plus 1 month"
    ExpiresByType image/jpeg                "access plus 1 month"
    ExpiresByType image/jpg                 "access plus 1 month"
    ExpiresByType image/png                 "access plus 1 month"
    ExpiresByType image/svg+xml             "access plus 1 month"

  # CSS

    ExpiresByType text/css                  "access plus 1 week"

  # JavaScript

    ExpiresByType text/javascript           "access plus 1 week"
    ExpiresByType application/x-javascript  "access plus 1 month"
    ExpiresByType application/javascript    "access plus 1 month"

  # Web fonts

    # Embedded OpenType (EOT)

    ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
    ExpiresByType font/eot                              "access plus 1 month"

    # OpenType

    ExpiresByType font/opentype                         "access plus 1 month"

    # TrueType

    ExpiresByType application/x-font-ttf                "access plus 1 month"

    # Web Open Font Format (WOFF) 1.0

    ExpiresByType application/font-woff                 "access plus 1 month"
    ExpiresByType application/x-font-woff               "access plus 1 month"
    ExpiresByType font/woff                             "access plus 1 month"

    # Web Open Font Format (WOFF) 2.0

    ExpiresByType application/font-woff2                "access plus 1 month"

</IfModule>

# ----------------------------------------------------------------------
# | ETags                                                              |
# ----------------------------------------------------------------------

<IfModule mod_headers.c>
  Header unset ETag
</IfModule>

FileETag None

Sorry for the ugly code embed – but I couldn’t find any help to make it look better.

So maybe it was your browser cache after all. :slight_smile:

Regarding the code embed: I have edited it to use three backticks at the start and end, now it’s working properly.

Sorry, still no all-clear from me. I’ve removed all caching directives from .htaccess, cleared the Safari’s cache, restarted Safari and disabled the content blocker (Roadblock) in Safari. I needed three times to log into the panel and twice saving a brand new page failed.

I’ll try to use FF and Chrome a little more together with the panel to rule-out it is some server side problem.