Some fonts dont work Google App Engine (wordpress)

2019-09-01 10:23发布

问题:

I have installed wordpress in GAE. My wordpress installation has the popular Woocommerce plugin activated. The problem with this setup is that some of my fonts are not working. This is what I see :

The boxes should actually be stars. I am not sure, but I think this is happening because the mime type cant be guessed by GAE. In my browser console, I get the following messages

Resource interpreted as Image but transferred with MIME type application/x-javascript:

this is my app.yaml:

application: XXXXXXX
version: 101
runtime: php
api_version: 1

handlers:
- url: /(.*\.(htm$|html$|css$|js$))
  static_files: wordpress/\1
  upload: wordpress/.*\.(htm$|html$|css$|js$)
  application_readable: true

- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
  static_files: wordpress/wp-content/\1
  upload: wordpress/wp-content/.*\.(ico$|jpg$|png$|gif$)
  application_readable: true

- url: /(.*\.(ico$|jpg$|png$|gif$))
  static_files: wordpress/\1
  upload: wordpress/.*\.(ico$|jpg$|png$|gif$)

- url: /wp-admin/(.+)
  script: wordpress/wp-admin/\1
  secure: always

- url: /wp-admin/
  script: wordpress/wp-admin/index.php
  secure: always

- url: /wp-login.php
  script: wordpress/wp-login.php
  secure: always

- url: /wp-cron.php
  script: wordpress/wp-cron.php
  login: admin

- url: /xmlrpc.php
  script: wordpress/xmlrpc.php

- url: /wp-(.+).php
  script: wordpress/wp-\1.php

- url: /(.+)?/?
  script: wordpress/index.php

- url: /(.*\.woff)
  static_files: wordpress/\1
  upload: wordpress/(.*\.woff)
  mime_type: application/font-woff

- url: /(.*\.svg)
  static_files: wordpress/\1
  upload: wordpress/(.*\.svg)
  mime_type: image/svg+xml

- url: /(.*\.eot)
  static_files: wordpress/\1
  upload: wordpress/(.*\.eot)
  mime_type: application/vnd.ms-fontobject

- url: /(.*\.ttf)
  static_files: wordpress/\1
  upload: wordpress/(.*\.ttf)
  mime_type: application/x-font-ttf

- url: /(.*\.otf)
  static_files: wordpress/\1
  upload: wordpress/(.*\.otf)
  mime_type: application/x-font-otf

回答1:

My limited (and possibly stale) experience with pagespeed suggests that you might consider disabling it until you have everything else working.

The only thing that jumps out is that the first two - url: stanzas in your app.yaml should be exchanged. These stanzas are consulted in order. /wp-content/foo.js will be matched by the more general first stanza, which looks like it isn't what you want. I doubt that's what's causing the mime type confusion, but turning off pagespeed should give you better info for further debugging.