How can I retain the host header value?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
I am running a Quasar Framework SSR application through pm2 ecosystem file. The Quasar Application is trying to read the Host header and run some logic based on the domain name though which the application was accessed. This works well without pm2 but when running through pm2 the host header always resolves to localhost:3000 instead of the publicly available domain names which the users would use.
Ecosystem.config.js
module.exports = {
apps : [
{
name: "ssr-beta",
script: "D:/Beta/ssr/index.js",
instances: 1,
watch: true,
env: {
"PORT": 3000
}
}
]
}
--- PM2 report ----------------------------------------------------------------
Date : Tue Aug 31 2021 16:00:09 GMT+0000 (Greenwich Mean Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.1.0
node version : 12.19.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Dejan\AppData\Roaming\npm\node_modules\pm2-windows-service\src\service.js
argv0 : C:\Program Files\nodejs\node.exe
user : undefined
uid : N/A
gid : N/A
uptime : 12min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.1.0
node version : 12.19.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Dejan\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0 : node
user : Dejan
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
cpus nb : 4
freemem : 10418671616
totalmem : 16982241280
home : C:\Users\Dejan
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬─────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼─────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 2 │ ssr-beta │ default │ 0.0.1 │ cluster │ 6732 │ 12m │ 1 │ online │ 0.3% │ 56.1mb │ Dejan │ enabled │
│ 0 │ ssr-staging │ default │ 0.0.1 │ cluster │ 5268 │ 12m │ 0 │ online │ 4.1% │ 157.0mb │ Dejan │ enabled │
│ 1 │ ssr-staging │ default │ 0.0.1 │ cluster │ 8444 │ 12m │ 0 │ online │ 0% │ 65.6mb │ Dejan │ enabled │
└─────┴─────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\pm2\pm2.log last 20 lines:
PM2 | 2021-07-10T16:30:01: PM2 log: Stopping app:ssr-beta id:0
PM2 | 2021-07-10T16:30:01: PM2 log: [Watch] Stop watching ssr-staging
PM2 | 2021-07-10T16:30:01: PM2 log: Stopping app:ssr-staging id:1
PM2 | 2021-07-10T16:30:01: PM2 log: [Watch] Stop watching ssr-staging
PM2 | 2021-07-10T16:30:01: PM2 log: Stopping app:ssr-staging id:2
PM2 | 2021-07-10T16:30:01: PM2 log: [Watch] Stop watching ssr-beta
PM2 | 2021-07-10T16:30:02: PM2 log: Stopping app:ssr-beta id:3
PM2 | 2021-07-10T16:30:02: PM2 log: App name:ssr-beta id:3 disconnected
PM2 | 2021-07-10T16:30:02: PM2 log: App name:ssr-beta id:0 disconnected
PM2 | 2021-07-10T16:30:02: PM2 log: App name:ssr-staging id:1 disconnected
PM2 | 2021-07-10T16:30:02: PM2 log: App [ssr-staging:1] exited with code [1] via signal [SIGINT]
PM2 | 2021-07-10T16:30:02: PM2 log: App [ssr-beta:0] exited with code [1] via signal [SIGINT]
PM2 | 2021-07-10T16:30:02: PM2 log: App name:ssr-staging id:2 disconnected
PM2 | 2021-07-10T16:30:02: PM2 log: App [ssr-staging:2] exited with code [1] via signal [SIGINT]
PM2 | 2021-07-10T16:30:03: PM2 log: App [ssr-beta:3] exited with code [1] via signal [SIGINT]
PM2 | 2021-07-10T16:30:03: PM2 log: pid=7316 msg=process killed
PM2 | 2021-07-10T16:30:03: PM2 log: pid=7588 msg=process killed
PM2 | 2021-07-10T16:30:03: PM2 log: pid=7392 msg=process killed
PM2 | 2021-07-10T16:30:03: PM2 log: pid=7544 msg=process killed
PM2 | 2021-07-10T16:30:03: PM2 log: PM2 successfully stopped
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the direct Quasar SSR run with the PM2 run described in Ecosystem.config.js, using D:/Beta/ssr/index.js as the application entry point. First verify where the Host header is read and whether the public request reaches the PM2 process unchanged. Done means the SSR application receives the public domain instead of localhost:3000.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100