open-wa / wa-automate-nodejs

πŸ’¬ πŸ€– The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.15k stars 601 forks source link

{ "error": "unauthorised" } if running behind nginx proxy manager #3251

Closed scropion86 closed 5 days ago

scropion86 commented 1 week ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

hello, I am running the server in docker behind nginx proxy manager

here is my docker run command and config, note that I am using a volume holding the session.


2024-11-07T07:28:51.418183896Z Starting the application

2024-11-07T07:28:51.418460144Z Using version: latest

2024-11-07T07:28:51.418664699Z ./node_modules/@open-wa/wa-automate/bin/server.js --use-chrome --in-docker --qr-timeout 0 --popup --debug --force-port -w https://DOMAIN>COM/webhook/wa -p 8080 -k SOMEKEY--api-host https://MYDOMAIN>COM/ --host https://MYDOMAIN>COM/ --v

my nginx proxy manager config

{
  "id": 5,
  "created_on": "2024-11-05 09:54:21",
  "modified_on": "2024-11-05 09:56:42",
  "owner_user_id": 1,
  "domain_names": [
    "MYDOMAIN>COM"
  ],
  "forward_host": "openwa",
  "forward_port": 8080,
  "access_list_id": 0,
  "certificate_id": 6,
  "ssl_forced": true,
  "caching_enabled": false,
  "block_exploits": true,
  "advanced_config": "",
  "meta": {
    "letsencrypt_agree": false,
    "dns_challenge": false
  },
  "allow_websocket_upgrade": true,
  "http2_support": true,
  "forward_scheme": "http",
  "enabled": 1,
  "locations": [],
  "hsts_enabled": false,
  "hsts_subdomains": false
}

any request i made from the swagger docs or postman getting same error

{
  "error": "unauthorised"
}

image

Expected Behavior

No response

Steps To Reproduce

explained above

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

{
  "WA_VERSION": "2.3000.1018010039",
  "WA_AUTOMATE_VERSION": "4.74.0",
  "BROWSER_VERSION": "Chrome/130.0.6723.58",
  "START_TS": 1730964593490,
  "RAM_INFO": "Total: 1.00 GB | Free: 0.44 GB",
  "PPTR_VERSION": "23.6.0",
  "LATEST_VERSION": true,
  "CLI": true,
  "PATCH_HASH": "3aa89",
  "LAUNCH_TIME_MS": 26017,
  "ACC_TYPE": "PERSONAL",
  "chats": 165,
  "messages": 36,
  "contacts": 1123,
  "isBiz": false,
  "isMd": true,
  "INSTANCE_ID": "30331257-06aa-4a56-8852-1bea0148ec0e"
}

Environment

- OS: Linux 5.15
- Node: 23.0.0
- npm: 10.9.0

Screenshots/Logs

No response

Anything else?

No response

scropion86 commented 5 days ago

i have found the answer after searching discord server, this might help if some one get the same issue in the future

here is the answer in discord https://discord.com/channels/661438166758195211/895256233039233024/1064925648684064929

and you need to set nginx proxy manager advance config underscores_in_headers on; like this

image