scandipwa / create-magento-app

A zero-configuration tool-chain which allows to deploy Magento 2 application in minutes!
https://docs.create-magento-app.com
Open Software License 3.0
32 stars 20 forks source link

Incorrect settings for external connections to Magento #129

Closed ejnshtein closed 12 months ago

ejnshtein commented 1 year ago

Describe the bug

CMA incorrectly sets fastcgi_params for external connections when CMA is set with a custom "host" which is accessible through the web.
It can incorrectly load HTTP content to HTTPS pages

Expected behaviour

Should work

Actual behaviour

After ngrok changed domain, doesn't work

Usefull code

const dns = require('dns')
const { networkInterfaces } = require('os')
const ipRangeCheck = require('ip-range-check')

const ranges = networkInterfaces()
const values = Object.values(ranges).flatMap((v) => v)

const families = {
    4: 'IPv4',
    6: 'IPv6'
}

dns.promises
    .lookup('localhost')
    .then(({ address, family }) => {
        const filteredValues = values.filter(
            (v) => v.family === families[family]
        )

        console.log(
            ipRangeCheck(
                address,
                filteredValues.map((f) => f.cidr)
            )
        )
    })
    .catch(console.log)