tgstation / tgstation-server-webpanel

React application for interacting with tgstation-server
GNU Affero General Public License v3.0
10 stars 11 forks source link

channel.json 404 (Not Found) #152

Closed azenkov closed 11 months ago

azenkov commented 11 months ago

In production mode for some reason index.html is requesting channel.json, doesnt find it and throws an alert about fallback of some sort. Maybe I misconfigured it somehow?

Cyberboss commented 11 months ago

channel.json is served from the main server with some configuration. Is your server able to start without errors?

azenkov commented 11 months ago

from which server? I am using nginx to server the panel. I dont see where channel.json would come from

Cyberboss commented 11 months ago

To be clear, you are hosting tgstation-server right? Which is the main server this client is for.

azenkov commented 11 months ago

Yes. I do. But if I understand correctly it just sends a redirect to the panel if there is no API headers?

Cyberboss commented 11 months ago

Yes, the panel should be being hosted under /app if you have it enabled. You should be able to view channel.json by navigating to /app/channel.json. Are you able to do that?

What version of TGS are you using for reference?

azenkov commented 11 months ago

/app/channel.json gives me 404. And I dont see such file in the /dist folder. Is this something TSG is supposed to generate? Im on 5.16

Cyberboss commented 11 months ago

It's an API endpoint hosted by TGS itself, yes. Do you have ControlPanel:Enable set to true in your config?

Cyberboss commented 11 months ago

If yes, please upload your TGS log files.

azenkov commented 11 months ago

tgs_logs_config.zip Here are the logs and config files.

alexkar598 commented 11 months ago

Make sure the X-Webpanel-Fetch-Channel header is proxied

azenkov commented 11 months ago

Wouldn't nginx proxy all headers?

Cyberboss commented 11 months ago

Is your TGS hosted at the root of your site? i.e. xxx.yyy.zzz/app?

Cyberboss commented 11 months ago

The linked PR above is a TGS release I'm pushing with some additional logging. Hopefully, it will help diagnose the issue here.

azenkov commented 11 months ago

Is your TGS hosted at the root of your site? i.e. xxx.yyy.zzz/app?

yes

Cyberboss commented 11 months ago

Okay, hopefully this logging reveals more. I'll let you know when the update is out

On Fri, Sept 29, 2023, 6:47 p.m. Anton Zenkov @.***> wrote:

Is your TGS hosted at the root of your site? i.e. xxx.yyy.zzz/app?

yes

— Reply to this email directly, view it on GitHub https://github.com/tgstation/tgstation-server-webpanel/issues/152#issuecomment-1741559493, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6LA6RP37NLZGEV6ZQFILTX45FZBANCNFSM6AAAAAA5FIPFAY . You are receiving this because you commented.Message ID: @.***>

Cyberboss commented 11 months ago

It's out now, try updating and attempting to load the control panel and then send me the logs.

Also, can you set the MicrosoftLogLevel config to Warning please? It's very spammy and makes decoding the logs harder than it needs to.

azenkov commented 11 months ago

tgs-20231001.log here is it. To make it work I had to put a workaround in nginx config: location /app/channel.json { proxy_pass http://127.0.0.1:5000; break; }

Cyberboss commented 11 months ago

I don't see any control panel logs in the new version, it looks like you turned down both LogLevel and MicrosoftLogLevel. If it's working now though I suppose this is dealt with.

azenkov commented 11 months ago

Sorry. I still don't understand how I can configure tgs panel to be hosted on a URL different from /app. It seems like /app is hardcoded. Can someone plase explain me.

Cyberboss commented 11 months ago

Yes, it is hard coded. Not meant to be changed

On Sun, Oct 1, 2023, 12:58 a.m. Anton Zenkov @.***> wrote:

Sorry. I still don't understand how I can configure tgs panel to be hosted on a URL different from /app. It seems like /app is hardcoded. Can someone plase explain me.

— Reply to this email directly, view it on GitHub https://github.com/tgstation/tgstation-server-webpanel/issues/152#issuecomment-1741958984, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6LA6WQRI5BQOF275A4LQDX5DZ7TANCNFSM6AAAAAA5FIPFAY . You are receiving this because you modified the open/close state.Message ID: @.***>

Cyberboss commented 11 months ago

You can move the entire server to a subpart but the /app suffix must remain

On Sun, Oct 1, 2023, 12:59 a.m. Jordan Dominion @.***> wrote:

Yes, it is hard coded. Not meant to be changed

On Sun, Oct 1, 2023, 12:58 a.m. Anton Zenkov @.***> wrote:

Sorry. I still don't understand how I can configure tgs panel to be hosted on a URL different from /app. It seems like /app is hardcoded. Can someone plase explain me.

— Reply to this email directly, view it on GitHub https://github.com/tgstation/tgstation-server-webpanel/issues/152#issuecomment-1741958984, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6LA6WQRI5BQOF275A4LQDX5DZ7TANCNFSM6AAAAAA5FIPFAY . You are receiving this because you modified the open/close state.Message ID: @.*** com>

azenkov commented 11 months ago

This is what I ended up with. Had to rewrite URLS

    location = /tgs-panel {
            rewrite /tgs-panel / break;
            proxy_pass http://127.0.0.1:5000;
    }

    location ~ ^/tgs-panel/(.*)$ {
            rewrite ^/tgs-panel/(.*)$ /$1 break;
            proxy_pass http://127.0.0.1:5000;
    }