alexander171294 / RustMon

Rust game admin tool for servers (RustMonitor)
Apache License 2.0
21 stars 3 forks source link

Can't connect to a server #22

Closed Bazimek closed 2 years ago

Bazimek commented 2 years ago

It just does not do anything maybe because of some Rust update?

alexander171294 commented 2 years ago

This is strange, i can connect without problems,

ensure that you aren't connecting with ssl, because if you are using https then you can't connect to a socket without ssl like rust server.

Bazimek commented 2 years ago

I have on my website https turned on but when I go to the website with Rust Monitor it automaticly go to http not https so it should work? But it is just do nothing when I click on connect.

alexander171294 commented 2 years ago

neither shows the spinner of connection? check if in the chrome inspector (right click, inspect website), in the tab of networking, check if show an error connecting to your server IP.

alexander171294 commented 2 years ago

I used this link http://rustmon.tandilserver.com/#/connector to connect to my server and works fine.

Can you send me your link to try connect to my server?

In the last update i added some features, but I don't touch the connection websocket code.

alexander171294 commented 2 years ago

I have on my website https turned on but when I go to the website with Rust Monitor it automaticly go to http not https so it should work? But it is just do nothing when I click on connect.

Yes, if you use http:// without ssl even if you support ssl, then should work

alexander171294 commented 2 years ago

check if you have web rcon enabled in rust server command line, rcon.web true

Bazimek commented 2 years ago

Yes I have like from rcon.io I can normally connect or with other rcon tools.

alexander171294 commented 2 years ago

image

I can connect without problems :(

Bazimek commented 2 years ago

Can you test it from this rcon.gamearea.cz?

alexander171294 commented 2 years ago

I can't access to that url without use ssl, because this page automatically redirect me to https:// with an invalid ssl.

If you have invalid ssl you are using SSL and i think, that is the problem i think.

let me create an update in order to try fix it.

Bazimek commented 2 years ago

Oh thank you for your work and help. :-) This is the best rcon tool and I love it.

alexander171294 commented 2 years ago

Well I updated now the script adding instructions to connect from a website with https (in the connection page), but i'm not sure why your website automatically try to connect to a wss:// and this is making problems.

Try to fix your ssl and update the script in order to fix the problem.

If you have implemented new feature and you want to share with us, you can send me the source with new features and I will try to add that features to the project.

I added in the last updates (days ago), new features like, chat mute, and sub-menu to order the actions like add mods, and I added flags to see from where is the ip, and "tags" in server configuration popup.

Bazimek commented 2 years ago

I am using the last version from there, and the SSL is normally working on my website and other subwebsites. The website needs to be made for ssl/https. I have valid SSL certificate active on this domain.

alexander171294 commented 2 years ago

but in this case, when i open your website I get an invalid ssl:

image

And your server is automatically adding this: image

wss, but in the code says ws:// image

and in the tandilserver versions, i can connect and see connection to: image

as you see, for an unknown reason, your website is adding wsS to the connection string, and that is strange, idk why that happens.

Yes you are right, you have the last version srry.

alexander171294 commented 2 years ago

I'm trying to find a reason that explain why your website is adding a "S" in the connection string, because that happens only in your website :(

Bazimek commented 2 years ago

You are right, I found something with the SSL. Give me a minute for the certifiace on this subdomain.

alexander171294 commented 2 years ago

I'm would like to add a map with position of players, but I don't know how can i do that :(

Bazimek commented 2 years ago

Oh I think that wont be possible without oxide plugin on the server.

Bazimek commented 2 years ago

OK the SSL is now working for me, but still can't connect.

alexander171294 commented 2 years ago

I have a question, why are you running a development version?, how do you host the project?

are you using "ng build --prod" to build the distributables files? or are you using "ng build" only?, because Angular recommends to you to use the flag --prod in order to build to production.

I think that is the only one difference between your website and mine, and idk why in your website i can't connect but in my website i can, i think it is because one script is changing the connection schema from "ws://" to "wss://", can be because you are using development version.

check that.

Sorry but the problem it's really strange :(, if that is not the problem, can be the webserver or some like that, one security header or so.

Bazimek commented 2 years ago

I used npm build --prod I think, the ng build --prod just open some new file or something for me. And I host it in my hosting provider (the files from dist folder).

alexander171294 commented 2 years ago

okay, I suspect that you didn't use --prod in the last update, because when I opened the javascript console in your website, I saw this message from angular framework:

Angular is running in the development mode. Call enableProdMode() to enable the production mode.

That means you aren't using production, I'm viewing the angular web page in order to check if the flag --prod has changed to another flag, but can you try to rebuild the project using that flag?

And maybe that is the problem.

Bazimek commented 2 years ago

When I use ng build --prod it just open some text editor? Give me a sec.

alexander171294 commented 2 years ago

try this: npm run buildprod

that worked for me.

Bazimek commented 2 years ago

I run npm run build -- --prod it did something, but still can't connect.

Bazimek commented 2 years ago

I Build it from beggining now correctly with ng build --prod .. but still it is not working for me :(

alexander171294 commented 2 years ago

Okay, i found the problem, I see in firefox that the server (your apache or webserver) is sending "Content-Security-Policy" header:

content-security-policy: upgrade-insecure-requests;

And as say in this post: https://stackoverflow.com/questions/31950470/what-is-the-upgrade-insecure-requests-http-header

This can be the reason because the websocket is trying to use ssl with rust ip,

My server headers that works: image

Your server headers that doesn't work: image

I think that can be fixed with a configuration in apache in a .htaccess file:

Header unset Content-Security-Policy

or

Header always unset Content-Security-Policy

Then remember to allow the use of insecure content (the connection to rust server rcon is insecured) following this article:

https://www.damirscorner.com/blog/posts/20210528-AllowingInsecureWebsocketConnections.html

alexander171294 commented 2 years ago

I think you added the .htaccess, now i can connect from firefox, but from chrome i can't because i think that have a cache o some like that, because when I try in other pc, i can connect without a problem, check the photo:

image

Bazimek commented 2 years ago

Yes I added to the subdomain the htaccess but it does not work for me. I am using Edge.

alexander171294 commented 2 years ago

yes it's because your browser is saving your headers and ignoring deletion,

https://stackoverflow.com/questions/33014574/how-to-force-a-browser-to-get-new-headers-without-declaring-expires

As you see, you can't do nothing to fix that in your browser, i think you can try to change the domain to rcon2 or so, or use other browser.

Or you can add a proxy like nginx reverse proxy, to add wss to your rust server.

Bazimek commented 2 years ago

Thank you, I did the tutorial from your website then I turn off the SSL and it can atleast connect now. :-) Thank you.