claabs / epicgames-freegames-node

Automatically login and find available free games the Epic Games Store. Sends you a prepopulated checkout link so you can complete the checkout after logging in. Supports multiple accounts, login sessions, and scheduled runs.
https://hub.docker.com/r/charlocharlie/epicgames-freegames
MIT License
1.33k stars 89 forks source link

404 Cannot GET / with non-root base URL and nginx proxy #333

Closed timotheeandres closed 1 year ago

timotheeandres commented 1 year ago

Describe the bug

Using the latest Docker image on charlocharlie/epicgames-freegames. When I try to click on the link in the Telegram notification I get, I am greeted by a 404 Cannot GET /. I tried editing the nginx config multiple times, thinking it was a WebSocket problem, but using https://<domain>/ instead of https://<domain>/epicgames/ as base URL and using location /in nginx works properly (almost, I seem to have a bug with the login, but this might be on EPIC's side).

Screenshots or Logs

Screenshot: Epic Cannot GET

Docker logs:

utilities-epicgames-freegames-1  | > epicgames-freegames-node@4.1.0 entrypoint-config
utilities-epicgames-freegames-1  | > node dist/src/entrypoint-config.js
utilities-epicgames-freegames-1  |
utilities-epicgames-freegames-1  | Setting timezone: UTC
utilities-epicgames-freegames-1  | Run on startup: true
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.115 +0000] INFO: Started epicgames-freegames-node
utilities-epicgames-freegames-1  |     COMMIT_SHA: "851cbbdc4d3e4e40d41f0358cefcdba281487758"
utilities-epicgames-freegames-1  |     BRANCH: "master"
utilities-epicgames-freegames-1  |     DISTRO: "alpine"
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.116 +0000] DEBUG: Performing version check
utilities-epicgames-freegames-1  |     PROJECT_NAME: "epicgames-freegames-node"
utilities-epicgames-freegames-1  |     BRANCH: "master"
utilities-epicgames-freegames-1  |     COMMIT_SHA: "851cbbdc4d3e4e40d41f0358cefcdba281487758"
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.421 +0000] TRACE: Response from GitHub API
utilities-epicgames-freegames-1  |     latestSha: "851cbbdc4d3e4e40d41f0358cefcdba281487758"
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.421 +0000] INFO: Testing all configured notifiers
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.421 +0000] DEBUG: Launching a new browser
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.585 +0000] DEBUG: Launching a new page
utilities-epicgames-freegames-1  | [2023-03-10 08:23:30.656 +0000] TRACE: devtools://devtools/bundled/inspector.html?ws=127.0.0.1:37223/devtools/page/C176B970BC3D59B595487FACCD92ED06
utilities-epicgames-freegames-1  | [2023-03-10 08:23:31.073 +0000] TRACE: Sending telegram notification
utilities-epicgames-freegames-1  |     user: <redacted>
utilities-epicgames-freegames-1  |     reason: "TEST"
utilities-epicgames-freegames-1  | [2023-03-10 08:23:31.073 +0000] TRACE: Sending json payload
utilities-epicgames-freegames-1  |     user: <redacted>
utilities-epicgames-freegames-1  |     reason: "TEST"
utilities-epicgames-freegames-1  |     jsonPayload: {
utilities-epicgames-freegames-1  |       "chat_id": <redacted>
utilities-epicgames-freegames-1  |       "text": "epicgames\\-freegames\\-node\nreason: TEST,\naccount: <redacted>\nurl: [Click here](https://<redacted>/epicgames/?targetId=C176B970BC3D59B595487FACCD92ED06)",
utilities-epicgames-freegames-1  |       "disable_web_page_preview": true,
utilities-epicgames-freegames-1  |       "parse_mode": "MarkdownV2"
utilities-epicgames-freegames-1  |     }
utilities-epicgames-freegames-1  | [2023-03-10 08:23:31.204 +0000] INFO: Test notifications sent. Waiting for test page interaction...

Additional context

nginx configuration:

  location /epicgames {
    return 302 $scheme://$host/epicgames/;
  }

  location /epicgames/ {
    proxy_pass http://127.0.0.1:3000/;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $host;
  }

config.json5:

{
  "runOnStartup": true,
  "cronSchedule": "5 16 * * *",
  "logLevel": "trace",
  "testNotifiers": true,
  "webPortalConfig": {
    "baseUrl": "https://<redacted>/epicgames/",
  },
  "accounts": [
    {
      "email": <redacted>,
      "password": <redacted>,
      "totp": <redacted>
    },
  ],
   "notifiers": [
     {
       "type": "telegram",
       "token": <redacted>,
       "chatId": <redacted>,
     },
   ],
}
timotheeandres commented 1 year ago

I do not know exactly why it works, but I found a workaround: in nginx, I removed proxy_redirect off; and changed proxy_pass http://127.0.0.1:3000/; to proxy_pass http://127.0.0.1:3000/epicgames/;