Forum / NoMachine Terminal Server Products / Htd.cfg redirect
- This topic has 4 replies, 3 voices, and was last updated 6 years, 4 months ago by dc2008.
-
AuthorPosts
-
August 17, 2018 at 14:59 #19356dc2008Participant
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
August 17, 2018 at 16:36 #19360BilbotineParticipantHi 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
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
August 20, 2018 at 10:35 #19361dc2008ParticipantThanks 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
August 22, 2018 at 15:16 #19402BritgirlKeymasterThere was a typo in Bilbotine’s reply.
it will redirect from
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 ]
August 23, 2018 at 07:33 #19404dc2008ParticipantYep 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
-
AuthorPosts
This topic was marked as solved, you can't post.