Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker not working , header_mismatch, customDomainHeaderValue: undefined #295

Closed
changchichung opened this issue Jan 26, 2024 · 16 comments
Closed

Comments

@changchichung
Copy link

docker logs

2024-01-26 02:54:27 (13.4 MB/s) - ‘/root/.nvm/.cache/bin/node-v20.11.0-linux-x64/node-v20.11.0-linux-x64.tar.xz’ saved [25522792/25522792]

Computing checksum with sha256sum
Checksums matched!
Now using node v20.11.0 (npm v10.2.4)
Creating default alias: default -> 20 (-> v20.11.0 *)
Now using node v20.11.0 (npm v10.2.4)
/usr/local/bin/nuxt-wrapper.sh: line 12: /app/.nuxt.env: No such file or directory
/usr/local/bin/nuxt-wrapper.sh: line 14: env.sh: No such file or directory
Listening on http://[::]:3000
Redirecting to main domain {
  reason: 'header_mismatch',
  customDomainHeaderValue: undefined,
  host: '192.168.100.2'
}
192.168.100.55 - - [26/Jan/2024:02:54:35 +0000] "GET /?utm_source=failed_custom_domain_redirect HTTP/1.1" 301 138 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0"

I also try cp .docker.env .env and mapping .env to container, my docker command

docker run --name opnform -v $PWD/.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 km/opnform

and part of my .env file

 cat .env
APP_NAME="OpnForm"
APP_ENV=local
APP_KEY=base64:7CPY4w4JNasdasdomY=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://192.168.100.2:8007

so , where should I modify the customdomain value ? ?

@JonasTrampe
Copy link

I have the same problem.

@Jogai
Copy link

Jogai commented Jan 27, 2024

See #283

@JhumanJ
Copy link
Owner

JhumanJ commented Jan 28, 2024

Hi, can you try setting your docker client env to:

NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false

We probably need to update the default settings to this

@changchichung
Copy link
Author

Hi, can you try setting your docker client env to:

NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false

We probably need to update the default settings to this

still not working , the same error messages.

my docker command

NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false NUXT_PUBLIC_ENV=local NUXT_PUBLIC_PAID_PLANS_ENABLED=false NUXT_PUBLIC_S3_ENABLED=false docker run --name opnform -v $PWD/.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 km/opnform

docker logs

192.168.100.55 - - [31/Jan/2024:07:35:29 +0000] "GET / HTTP/1.1" 301 138 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0"
Redirecting to main domain {
  reason: 'header_mismatch',
  customDomainHeaderValue: undefined,
  host: '192.168.100.2'
}

@JhumanJ
Copy link
Owner

JhumanJ commented Jan 31, 2024

The issue comes from this code: /client/lib/utils.js#L75-L81

export const customDomainUsed = function() {
  const config = useRuntimeConfig()
  const appDomain = getDomain(config.public.appUrl)
  const host = getHost()

  return host !== appDomain && getDomain(host) !== appDomain
}

Please make sure that NUXT_PUBLIC_APP_URL has the right value? It should be the same as your app URL, so I believe 192.168.100.2 in your case

@changchichung
Copy link
Author

changchichung commented Jan 31, 2024

my docker command

docker run --name opnform -v $PWD/.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform

my .env file

2024-01-31 16:59:56 [administrator@ubuntu-jammy-server OpnForm  main ]$ cat .env
APP_NAME="OpnForm"
APP_ENV=local
APP_KEY=base64:HR7785OpccUnYEk6Mbkl4rnkB22ggfkTzNuGCUTO/4A=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://localhost

LOG_CHANNEL=errorlog
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres

FILESYSTEM_DRIVER=s3
FILESYSTEM_DISK=s3

BROADCAST_DRIVER=log
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

JWT_TTL=1440
JWT_SECRET=9yaUSlRlBcdmiHoYL59i4XPtsmmGKS5dQt5Hhb2dwGphZAmqPJmhcQvmrADt9vkh

MUX_WORKSPACE_ID=
MUX_API_TOKEN=

OPEN_AI_API_KEY=

#FRONT_URL="http://192.168.100.2:8007"
NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false
NUXT_PUBLIC_APP_URL="http://192.168.100.2:8007"
FRONT_API_SECRET=TiZMuWIF

same error in docker log

Redirecting to main domain {
  reason: 'header_mismatch',
  customDomainHeaderValue: undefined,
  host: '192.168.100.2'
}

@JhumanJ
Copy link
Owner

JhumanJ commented Jan 31, 2024

@changchichung there are 2 .env files, one for client and one for Nuxt, please make sure to pass the nuxt .env to nuxt

Custom Laravel .env file:

docker run --name opnform -v $PWD/custom-laravel-env-file.env:/app/.env -v $PWD/my-opnform-data:/persist -p 80:80 jhumanj/opnform

Custom Nuxt .env file:

docker run --name opnform -v $PWD/custom-nuxt-env-file.env:/app/client/.env -v $PWD/my-opnform-data:/persist -p 80:80 jhumanj/opnform

@changchichung
Copy link
Author

even with Custom Nuxt .env file , the error was still there.

but in docker logs , I found something interseting .

Now using node v20.11.0 (npm v10.2.4)
Creating default alias: default -> 20 (-> v20.11.0 *)
Now using node v20.11.0 (npm v10.2.4)
/usr/local/bin/nuxt-wrapper.sh: line 12: /app/.nuxt.env: No such file or directory
/usr/local/bin/nuxt-wrapper.sh: line 14: env.sh: No such file or directory
Listening on http://[::]:3000

so I mapping .env file to /app/.nuxt.env instead of mapping to /app/client/.env , and now it works !
I can see the homepage now , but some imgs are missing.

@JhumanJ
Copy link
Owner

JhumanJ commented Jan 31, 2024

I'll give this a proper try this afternoon, could you please try to send me all the steps to reproduce?

@changchichung
Copy link
Author

git clone https://github.com/JhumanJ/OpnForm
cd OpnForm

add a start.sh

#!/bin/bash

#docker run --name opnform -v ./.env:/app/.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform
docker run --name opnform -d -v ./.env:/app/client/.env -v ./.env:/app/.nuxt.env -v $PWD/my-opnform-data:/persist -p 8007:80 jhumanj/opnform

cp .env.docker .env
append

NUXT_PUBLIC_CUSTOM_DOMAINS_ENABLED=false
NUXT_PUBLIC_ENV=local
NUXT_PUBLIC_PAID_PLANS_ENABLED=false
NUXT_PUBLIC_S3_ENABLED=false
NUXT_PUBLIC_APP_URL="192.168.100.2"

to .env file

then run start.sh to bring up the container.

and when I try to open the image URL , there are some error in browser .

{"error":{"message":"[500] [IPX_ERROR] Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n    npm install --include=optional sharp\n    yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n    See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n    npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n    See https://sharp.pixelplumbing.com/install"}}

@JhumanJ
Copy link
Owner

JhumanJ commented Feb 5, 2024

Hi there, I just went through the process again, without changing any .env files and it worked just fine. I only ran docker run --name opnform -v $PWD/my-opnform-data:/persist -p 8000:80 --platform linux/amd64 jhumanj/opnform

Can you please try this yourself without customizing the .env files?

@changchichung
Copy link
Author

ok , here is complete log of my steps , just git clone and docker run , it's the same error.

https://pastebin.com/TSsF0t7Q

@JhumanJ
Copy link
Owner

JhumanJ commented Feb 5, 2024

I just simplified the custom domain handling for docker environment to avoid this issue, can please try again pulling the latest docker image?

@changchichung
Copy link
Author

ok , with the latest docker image , the container works ! thanks !

but some images are still missing.

when I try to directly open the img file , it throw out some error

{
    "error": {
        "message": "[500] [IPX_ERROR] Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n    npm install --include=optional sharp\n    yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n    See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n    npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n    See https://sharp.pixelplumbing.com/install"
    }
}

@JhumanJ
Copy link
Owner

JhumanJ commented Feb 6, 2024

We're working on it!

donuk added a commit to donuk/OpnFormDev that referenced this issue Feb 6, 2024
donuk added a commit to donuk/OpnFormDev that referenced this issue Feb 6, 2024
JhumanJ pushed a commit that referenced this issue Feb 6, 2024
* Bypass sharp in docker hosted environment #295

* Use correct environment path #295
@JhumanJ
Copy link
Owner

JhumanJ commented Feb 6, 2024

Fixed! I'll draft the release now! #312

@JhumanJ JhumanJ closed this as completed Feb 6, 2024
donuk added a commit to donuk/OpnFormDev that referenced this issue Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants