Jackzmc / l4d2-stats-plugin

L4D2 statistics tracking plugin & website
https://stats.jackz.me
MIT License
13 stars 5 forks source link

How to use caddy to reverse it #29

Closed Kaze1027 closed 1 year ago

Kaze1027 commented 1 year ago

I want to use caddy as frontend to process web pages, can you show me how to config it? I've tried, but it comes error that "Invalid Host header" image

Jackzmc commented 1 year ago

I'm not super familiar with caddy, but you do need to rewrite the Host header for the express server to accept it.

From quick googling, it looks like you can do this:

reverse_proxy ... {
    Host {upstream_hostport}
    ...
}

reverse_proxy

Kaze1027 commented 1 year ago

Thank you for your reply, I've build website, but here are some error info I found, is that My database mysql is mysql8.0? Does it support mysql8.0?

Jackzmc commented 1 year ago

You didn't submit any error info. MySQL 8 seems to be pretty old, my server is running 15, but I need your error info verify the issue.

Kaze1027 commented 1 year ago

Here's some error info:

Aug 09 13:46:12 kazess-ubuntu yarn[15804]: yarn node v1.22.19
Aug 09 13:46:12 kazess-ubuntu yarn[15826]: Connecting to yd.l4d2.top database KAZE
Aug 09 13:46:12 kazess-ubuntu yarn[15826]: [Server] Listening on :8081
Aug 09 13:46:15 kazess-ubuntu yarn[15826]: [/api/top] Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'KAZE.stats_games.honks' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Aug 09 13:51:20 kazess-ubuntu yarn[15826]: [/api/top] Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'KAZE.stats_games.honks' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Aug 09 13:51:26 kazess-ubuntu yarn[15826]: [/api/user/:user/image] TypeError: Cannot read properties of null (reading 'name')
Aug 09 13:51:26 kazess-ubuntu yarn[15826]:     at /var/www/html/l4d2-stats-plugin/website-api/routes/user.js:258:36
Aug 09 13:51:26 kazess-ubuntu yarn[15826]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
Aug 09 13:51:38 kazess-ubuntu yarn[15826]: [/api/user/:user/image] TypeError: Cannot read properties of null (reading 'name')
Aug 09 13:51:38 kazess-ubuntu yarn[15826]:     at /var/www/html/l4d2-stats-plugin/website-api/routes/user.js:258:36
Aug 09 13:51:38 kazess-ubuntu yarn[15826]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
Aug 09 13:51:42 kazess-ubuntu yarn[15826]: [/api/user/:user/image] TypeError: Cannot read properties of null (reading 'name')
Aug 09 13:51:42 kazess-ubuntu yarn[15826]:     at /var/www/html/l4d2-stats-plugin/website-api/routes/user.js:258:36
Aug 09 13:51:42 kazess-ubuntu yarn[15826]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[/api/top] Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'KAZE.stats_games.honks' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

image

image

Jackzmc commented 1 year ago

I think you have an old version of the tables. This is more of a personal project, so I've neglected updating some things.

The stats_database.sql should be up to date now, it will recreate the tables tho (losing any data)

Jackzmc commented 1 year ago

And yeah the play style and rating will not work, that is custom for my system.

Kaze1027 commented 1 year ago

I greatly appreciate for your work, it's fine that I'll rebuild my satabase, there is no data now except test data. I'm gonna try it. : )