Giter Site home page Giter Site logo

Comments (13)

xanthos84 avatar xanthos84 commented on July 18, 2024

Okay got it,
dont need the nginx.
in the apache you have to use the localhost:5000 as reverse proxy target and not IP:5000

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

Ok I Thougt I got it, the web interface is fine now - no more connection lost.
But when I now install a new remotely client on windows/linux,
I got this following in Remotely_Logs.txt after installation:

{"Type":"Error","Timestamp":"6/9/2019 12:23:18 PM","Message":"Response status code does not indicate success: 405 (Method Not Allowed).","Source":"System.Net.Http","StackTrace":" at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\r\n at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync(Uri url, HttpClient httpClient, ILogger logger)\r\n at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync(Uri uri)\r\n at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport(TransferFormat transferFormat)\r\n at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore(TransferFormat transferFormat)\r\n at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync(TransferFormat transferFormat, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.SignalR.Client.HttpConnectionFactory.ConnectAsync(TransferFormat transferFormat, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.SignalR.Client.HttpConnectionFactory.ConnectAsync(TransferFormat transferFormat, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore(CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsync(CancellationToken cancellationToken)\r\n at Remotely_Agent.Services.DeviceSocket.Connect() in D:\a\1\s\Remotely_Agent\Services\DeviceSocket.cs:line 39\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Threading.ThreadPoolWorkQueue.Dispatch()"}

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

and after another research I found the solution why the client cant connect,
in the Installation Powershell script, the URL is http:// but (in my case) it should be https://
so i manually edited the downloaded installation script,
reinstalled,
and voila - client can connect successfully.

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

is it possible to change this in the system? so i dont have to manually edit the files everytime i download them?

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

oh man... the installation is really a hassle....
now I can connect to one linux desktop
but on two windows remote desktops I cant connect (different networks)

Launching remote control on client device...
~>
Starting remote control...

but nothing happens on the web interface anymore...

What could be wrong? Are there any firewall adjustments needed? Or how can I debug why the connection is not succesful?

from remotely.

bitbound avatar bitbound commented on July 18, 2024

Setting up ASP.NET Core behind a reverse proxy can be complicated, and the script is only designed to handle one scenario.

The file is showing "http" instead of "https" because it's not getting or trusting the forwarded headers (scheme and IP address) from Apache. The script adds this to the Nginx config, so you'll need to replicate it in Apache.

I haven't done this in Apache before, so I don't know if anything else is required in the configuration.

This article explains the process: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-2.2

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

thank you for your response!
well the main issue is really that it cant connect now to the clients...
the clients connect/register themself fine to the server...

and i am not sure why its not working as i cant really debug the route... i dont know what happens behind the connect to trace where it stops because there is no error message/log...

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

but i guess it has something to do with http and https requests as I found in debug mode:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 POST http://my.website/BrowserHub?id=SjGsUq7QfBsPACU9DI19XQ text/plain;charset=UTF-8 11

and thats not cool, as it should be https!
i have added redirect http to https to apache, but its still not connecting...

from remotely.

bitbound avatar bitbound commented on July 18, 2024

The headers need to be forwarded before anything will work. It's a requirement. There's no sense troubleshooting anything until that's done.

Please read this to understand why it's required: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-2.2#configure-a-proxy-server

After that, I don't know, because I haven't tested it with Apache.

from remotely.

bitbound avatar bitbound commented on July 18, 2024

Also, I almost forgot...

There's a special Nginx configuration for the SiganlR hubs (websocket endpoints), which the install script does automatically. You'll need to replicate this behavior in Apache. See how the Hub endpoints are handled in the script: https://github.com/Jay-Rad/Remotely/blob/master/Utilities/Remotely_Server_Install.sh

Please keep in mind this isn't specific to Remotely. These concepts and requirements apply to any ASP.NET Core application running behind Nginx/Apache that uses authentication and SignalR.

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

Thank you for trying to help me out,
I have now tried really every single apache setting about reverse proxying...

But in the end I only get a

fail: Microsoft.AspNetCore.SignalR.HubConnectionContext[5]
Failed connection handshake.

in the log of remotely server.... not sure what I can do..

from remotely.

xanthos84 avatar xanthos84 commented on July 18, 2024

well the handshake error is gone now.
got no errors anymore,
added some websocket proxying into apache configs,
but still getting no connection to the client.

that is what I have tried:

ProxyPass /BrowserHub ws://localhost:5000/BrowserHub
ProxyPassReverse /BrowserHub ws://localhost:5000/BrowserHub

ProxyPass /DeviceHub ws://localhost:5000/DeviceHub
ProxyPassReverse /DeviceHub ws://localhost:5000/DeviceHub

ProxyPass /RCBrowserHub ws://localhost:5000/RCBrowserHub
ProxyPassReverse /RCBrowserHub ws://localhost:5000/RCBrowserHub

ProxyPass /RCDeviceHub ws://localhost:5000/RCDeviceHub
ProxyPassReverse /RCDeviceHub ws://localhost:5000/RCDeviceHub

as I think every target above is requiring websocket , is this correct?

from remotely.

bitbound avatar bitbound commented on July 18, 2024

Below is the configuration I'm using for Nginx, and it works. I don't have time to test on Apache, though.

I'll be closing this issue since it pertains to the hosting environment and doesn't involve an issue with the application. There are likely resources out there that can show you how to configure Apache for SignalR Core.

Configure Nginx

nginxConfig="server {
listen 80;
server_name $serverHost *.$serverHost;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /BrowserHub {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /DeviceHub {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /RCBrowserHub {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /RCDeviceHub {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}"

from remotely.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.