Today I learned Nuxt PWA lang & max file size limit on PHP

  • Written on: Su Dec 2020
  • Last update: Su Dec 2020

Nuxt htmlAttrs lang won't override

I was struggling on one of my side-project to override the lang attribute in the html tag. I specified in my nuxt.config.js the lang like below :

module.exports = {
  head: {
    htmlAttrs: {
      lang: 'fr'
    }
  }
}

But even with that, it wouldn't override the lang attribute. It kept saying it was en instead of fr. The problem causing that was the Nuxt PWA module.

Indeed, as you can see in https://github.com/nuxt-community/pwa-module/blob/master/src/meta.ts#L154, the Nuxt PWA module overrides the head meta tags with it's own properties. By default, Nuxt PWA module have the lang attribute to en.

Knowing that, I just specified the lang I wanted in the Nuxt PWA module options instead of the htmlAttrs object like the following:

module.exports = {
  pwa: {
    lang: 'fr'
  }
}

Increase max file upload

When we handle file uploads with PHP, we must take into account the max upload file size limit set by default (2M). To increase that limit, it must be changed in the php.ini file by adding (or updating) it with:

post_max_size = 20M
upload_max_filesize = 20M

In my case I have a reverse proxy for fpm stuff. That means I also have to increase the max file upload limit in Nginx. This can be made by adding a new rule to your server block:

client_max_body_size 20M;

Since I'm deploying all my things on Kubernetes, I also need to take care of my Nginx ingress. For the ingress, I can use the anotation available:

nginx.ingress.kubernetes.io/proxy-body-size: 20m