is this the correct way to migrate middleware from strapi beta 20.4 to 3?

Viewed 501

I have been following the migration tutorial here from strapi

https://strapi.io/documentation/v3.x/migration-guide/migration-guide-beta.20-to-3.0.0.html

up until the middleware.js part.

I wonder if this is the correct way to setup

module.exports = {
    timeout: 100,
    load: {
        before: [ 'responseTime', 'logger', 'cors', 'responses', 'gzip' ],
        order: [
            "Define the middlewares' load order by putting their name in this array is the right order",
        ],
        after: [ 'parser', 'router' ],
    },
    settings: {
        public: {
            path: './public',
            maxAge: 60000,
        },
        // request middlewares
        session: {
            "enabled": true,
            "client": "cookie",
            "maxAge": 86400000,
            "overwrite": true,
            "signed": false,
            "rolling": false
        },
        logger: {
            "level": "info",
            "exposeInContext": true,
            "requests": false
        },
        parser: {
            "enabled": true,
            "multipart": true
        },
        // response middlewares
        "gzip": {
            "enabled": false
        },
        "responseTime": {
            "enabled": false
        },
        "poweredBy": {
            "enabled": true,
            "value": "Strapi <strapi.io>"
        },
        // security middlewares
        "csp": {
            "enabled": true,
            "policy": ["block-all-mixed-content"]
        },
        "p3p": {
            "enabled": false,
            "value": ""
        },
        "hsts": {
            "enabled": true,
            "maxAge": 31536000,
            "includeSubDomains": true
        },
        "xframe": {
            "enabled": true,
            "value": "SAMEORIGIN"
        },
        "xss": {
            "enabled": true,
            "mode": "block"
        },
        "cors": {
            "enabled": true
        },
        "ip": {
            "enabled": false,
            "whiteList": [],
            "blackList": []
        }
    },
};

if this is the correct way to setup but how about for language.json? Do I actually add

  "defaultLocale": "en_us",
  "modes": [
    "query",
    "subdomain",
    "cookie",
    "header",
    "url",
    "tld"
  ],
  "cookieName": "locale"

into the settings properly like the others? Reason why I am confused is because actually inside language.json there's also another property named enabled The original language.jsonlooks like this

{
  "enabled": true,
  "defaultLocale": "en_us",
  "modes": [
    "query",
    "subdomain",
    "cookie",
    "header",
    "url",
    "tld"
  ],
  "cookieName": "locale"
}

Also, another question about this configuration is that I also read the documentation of

https://strapi.io/documentation/v3.x/concepts/middlewares.html#core-middleware-configurations

Let me take the previous request.json it has the attribute of prefix, httpOnly, overwrite but then the new documentation does not show these fields, which means when I do the migration, I have to check which fields are actually not surported anymore?

Thanks in advance for any help

0 Answers
Related