Htd.cfg redirect

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19356
    dc2008
    Participant

    I am trying to redirect all my web connections to a specific connection file. E.g.

    When I enter https://example.com:4443 it should be redirected to https://example.com:4443/nxwebplayer?desktop

    Obviously the current (default) config redirects https://example.com:4443 to https://example.com:4443/nxwebplayer

     

    Is this possible?? what do I have to change in the htd.cfg file?

    As an extension to this, is it possible to redirect https://example.com straight to https://example.com:4443/nxwebplayer?desktop

    #19360
    Bilbotine
    Participant

    Hi dc2008,

    Yes it is possible, you will have to change htd.cfg:

    from:

    <VirtualHost _default_:*>

    RewriteEngine on

    ReWriteCond %{SERVER_PORT} !^4443$

    RewriteRule ^/(.*) https://%{SERVER_ADDR}:4443/nxwebplayer [R,L]

    </VirtualHost>

    to

    <VirtualHost _default_:*>

    RewriteEngine on

    ReWriteCond %{SERVER_PORT} !^4443$

    RewriteRule ^/(.*) https://%{SERVER_ADDR}:4443/nxwebplayer?desktop [R,L]

    </VirtualHost>

    exactly this line:

    RewriteRule ^/(.*) https://%{SERVER_ADDR}:4443/nxwebplayer?desktop [R,L]

    it will redirect from

     

    https://example.com:4080

    https://example.com:4443

     

    to

    https://example.com:4443/nxwebplayer?desktop

     

    In case if you want to make the redirection from the default port (80), to have the redirection from

    https://example.com to https://example.com:4443/nxwebplayer?desktop

     

    You will have to add listening nxhtd on 80 port.

    Edit htd.cfg file and add those lines:

     

    Listen 0.0.0.0:80

     

    Make sure that there isn’t any other service listening on that port, before making such a change.

     

    However, there is one thing you should know when doing all of this: when you redirect or simply type by hand in browser’s URL:

    https://example.com:4443/nxwebplayer?desktop

    the Web Player will try to load ‘desktop.nxs’ connection file, as described in

    https://www.nomachine.com/DT10O00160

    #19361
    dc2008
    Participant

    Thanks for your response.

    Yes that’s great i am looking for the desktop.nxs file to load.

    I have changed the line exactly as you advise, restarted nxserver but the redirect is still just taking me to https://example.com:4443/nxwebplayer

    Were you able to get this working? Is there any other config i have to update or refresh?

    Any help appreciated

    #19402
    Britgirl
    Keymaster

    There was a typo in Bilbotine’s reply.

    it will redirect from

    https://example.com:4080

    https://example.com:4443

    It should be

    http://example.com:4080
    https://example.com:4443

     

    For a working redirection of  https://example.com:4443 to https://example.com:4443/nxwebplayer?desktop, can you try this?

    Edit htd.cfg and make changes from:

    "
    <VirtualHost 0.0.0.0:4443>
      ServerAdmin you@example.com
    
      SSLEngine on
    
      SSLProtocol All -SSLv2 -SSLv3
    " 

    to look like:

    "
    <VirtualHost 0.0.0.0:4443>
      ServerAdmin you@example.com
    
      RewriteEngine On
    
      #RewriteCond %{REQUEST_URI} !\?desktop$
      RewriteCond %{REQUEST_URI} !^/nxwebplayer?desktop$
      RewriteRule ^/?(.*)/$ /$1/nxwebplayer?desktop [L,R]
    
      SSLEngine on
    
      SSLProtocol All -SSLv2 -SSLv3
    "

    When making any changes in htd.cfg nxhtd has to be stopped first with:

    # /etc/NX/nxserver --stop nxhtd

    – and after the change restarted using:

    # /etc/NX/nxserver --start nxhtd

    [ paths are examples on Linux ]

    #19404
    dc2008
    Participant

    Yep works great, i had to make a very slight change otherwise i got 2 “//” mid url:

     

     RewriteRule ^/?(.*)/$ /$1/nxwebplayer?desktop [L,R]
    
    to
    
     RewriteRule ^/?(.*)/$ $1/nxwebplayer?desktop [L,R]

     

    Thank you for your help

Viewing 5 posts - 1 through 5 (of 5 total)

This topic was marked as solved, you can't post.