Architecting, installing and maintaining your SAS environment

Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Reply
Contributor
Posts: 24

Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

We have a Visual Analytics non-distributed server and the VA URL is difficult for users to remember if they are on conference room computers or some other machine besides where they have a convenient shortcut to it.  I'm not trying to hide any URL info, but want to redirect a simple URL entry to the long VA URL.

 

Not sure of exactly how to accomplish this, we first added a DNS CName record for sas.brookshealth.local that resolves to cxpvwappsasva01.brookshealth.local (brookshealth.local is our domain).  I now need to configure our Apache server to perform a URL rewrite for the URN portion of the URL since DNS cannot do that.

 

I am not familiar with Apache, but doing some research and then searching our SAS VA server for matching Apache configuration files, I thought I had found the main config file, named httpd.conf.vm at:

\\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\Scripts\AppServer\src\Velocity\vfabrcersvrc\httpd.conf.vm

 

I wanted to redirect both the VA URL and a web page we created on our internal SharePoint site so to the bottom of this file I added:

Redirect permanent "/sas" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/

Redirect permanent "/LearnSAS" http://ebrooks/teams/DataScience/SitePages/SASVideos.aspx

 

Well, in searching for the path above for this post, I actually found a different file that may be the REAL SAS Apache config file:

\\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\WebServer\conf\httpd.conf

 

I'll stop services and re-try my code (will notify users of VA downtime), but I wanted to share what I had found and see if anyone knows if my syntax is simply wrong or if I edited the wrong file.  I'm also a bit concerned with using the "Redirect" Apache directive as it seems to be for domain redirection, changing the path before the trailing URL, but leaving the trailing URL "allowing" you to redirect

domain1\coolwebpage to domain2\coolwebpage ... I'm not trying to do that, but instead just trying to redirect one web page to another so perhaps there is a better way to perform this simpler task.  I couldn't locate the .htaccess file on the VA server, but with my new match on the httpd.conf file just now, I'll try searching for it again.

 

Thanks for any and all thoughts and feedback.  This is unsupported by SAS, but I don't think I'm getting too far out there with a simple URL redirection with a couple of lines of code change to an Apache configuration file.

 

Thanks,

Dennis

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

For the record, I didn't find the SAS flavor of the .htaccess file ...

Trusted Advisor
Posts: 1,739

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

Hello @D_e_n_n_i_s,

 

yours is a very good and common question. You are looking for rewrite/redirect URLs.

 

Here a few pinpoints:

- .htaccess : first, enable to look hidden and system files. Second, probably by default it is not there, but you can actually create one for your purposes.

 

- Did you check https://httpd.apache.org/docs/2.4/rewrite/remapping.html? This is my best friend for this requirement.

 

\Lev1\Web\WebServer\conf\httpd.conf is indeed a good place, you can check also \Lev1\Web\WebServer\conf\sas.conf

 

- When you make the change, indeed, you need to restart httpd/Apache

 

- just in case, you probably should white-list the alias in SAS Web Infrastructure Platform (in SAS Management Console), since it can be considered as cross-domain attack/referral.

 

Does it help you on any way?

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to JuanS_OCS

Hi @JuanS_OCS,

 

Wow, there's some serious help in your post so thanks for the amazing response..  I had looked through the Apache open source help pages, but did not see the very helpful link you noted.  Since I want the users to see the redirected URL (VA Hub), I'll try using the format:
RewriteEngine  on
RewriteRule    "^/foo\.html$"  "bar.html"  [R]

 

I'm thinking we don't even need a DNS entry and can simply redirect any URL to another through this mechanism.  So, if I wanted users to be able to type "sas" in their browser and have it redirect to our VA URL, I'm thinking the syntax would be:
RewriteEngine  on
RewriteRule "^/sas\.brookshealth.local" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/

and users would need to enter http://sas/ into their browser since just typing "sas" would trigger a browser search reply unless there was a DNS entry to map "sas" to http://sas.brookshealth.local ... Without a DNS entry, I guess they would have to type http://sas.brookshealth.local - Does any of this sound close?

 

Thanks for the tip too on the SAS files.  I'm going to take down the server today and I'll test modifying both the httpd.conf and the sas.conf that you reference and we'll see what happens.  I just want to try to get the syntax right before I do that.  I found that I have to stop the services to edit the file so I will definitely be bouncing the SAS services.

 

Great idea to whitelist the alias.  We had put links from SharePoint to SAS and they didn't work until I discovered that I had to whitelist our SharePoint site within the SAS Mgmt Console before SAS would allow the traffic from SharePoint.  It makes sense that this could be blocking the redirection as well - I hadn't even thought of this ... Thanks !!

 

This was a huge help and I appreciate any corrections to my thoughts on how to implement this.  Thanks again !!!

 

Thanks,
Dennis

 

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

If I add the following lines of code to the bottom of both configuration files
(\Lev1\Web\WebServer\conf\sas.conf and \\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\WebServer\conf\httpd.conf) and perhaps \\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\Scripts\AppServer\src\Velocity\vfabrcersvrc\httpd.conf.vm too just to test ... if users enter "http://sas.brookshealth.local" would it redirect them to our VA Hub URL (http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/):

 

RewriteEngine  on
RewriteRule "^/sas\.brookshealth.local" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/

 

Would I whitelist http://sas.brookshealth.local (rather than our VA Hub URL)?  If I have the DNS CName record modified to point "sas" to "http://sas.brookshealth.local" and then implement the code above, should users be able to type "sas" into their browser and get to the VA Hub URL?

 

I was just able to confirm that we will be spinnning up 2 Dev servers in 7-10 days so I can wait until then to perform the testing, but I'm anxious to try it out and report my results back here so that everyone can know how to make this happen since the VA Hub URL is long and difficult for users to remember.

 

Thanks,
Dennis

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

Recap:

We added a CNAME record for sas.brookshealth.local that resolves to cxpvwappsasva01.brookshealth.local

 

I found a doc from our first consultant team for setting up SSL, which we didn't do since we only access SAS internally, but it noted configuration files to change with only one that wasn't directly in reference to SSL:
E:\SAS\Config\Lev1\Web\WebServer\conf\httpd.conf

 

This is the same as the file I located earier (FQDN):
\\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\WebServer\conf\httpd.conf

 

I don't know if I need to edit the virtual machine file so I'll edit it to try to get this going and will eliminate it later:
\\cxpvwappsasva01\e$\SAS\Config\Lev1\Web\Scripts\AppServer\src\Velocity\vfabrcersvrc\httpd.conf.vm

 

I white-listed: http://sas.brookshealth.local/
This was done in SAS Mgmt Console.  For everyone's benefit, navigate to Application Management --> Configuration Manager --> Right-click SAS Application Infrastructure and select Properties --> Edit the sas.web.csrf.referers.knownHosts property
Note: Make sure to add a "/" character at the end of the URL being whitelisted.  For multiple URL's, separate them with a comma.  Restart your SAS Web Application Servers for changes to take effect.

 

Since I'm still unsure about the code to use, I'll add the following to the two files in the <IfModule alias_module> section:
Redirect permanent "http://sas.brookshealth.local/" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/
Redirect permanent "http://learnsas.brookshealth.local/" http://ebrooks/teams/DataScience/SitePages/SASVideos.aspx

 

I'll need to get another DNS CName record added to map "learnsas" to http://learnsas.brookshealth.local before that redirection will work.

 

I stopped all VA services (after notifying users to coordinate downtime), edited both files and rebooted the VA server.

 

Result: After making sure that I get the VA Hub login (VA is back up), I get a "Can't Reach This Page" error in a browser when using http://sas.brookshealth.local or http://learnsas.brookshealth.local

 

I stopped all SAS services again and replaced the above code in both files with:
RewriteEngine  on
RewriteRule "^/sas\.brookshealth.local" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub
RewriteRule "^/learnsas\.brookshealth.local" http://ebrooks/teams/DataScience/SitePages/SASVideos.aspx

 

Then, rebooted the VA server.

 

FInal Result:

Using Internet Explorer:

For http://sas.brookshealth.local/ I again get the same error, but I grabbed the details this time, which are:
There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND

 

For http://learnsas.brookshealth.local/, I get the same error, but details are:
The DNS name does not exist.
Error Code: INET_E_RESOURCE_NOT_FOUND

 

Using Chrome:

For http://sas.brookshealth.org, I get:
This site can't be reached
sas.brookshealth.local refused to connect
ERR_CONNECTION_REFUSED

 

For http://learnsas.brookshealth.org, I get
This site can't be reached
learnsas.brookshealth.local’s server IP address could not be found.
ERR_NAME_NOT_RESOLVED

 

 

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

Realizing that the CName record was redirecting the sas.brookshealth.local URL, I tried the following:

Redirect permanent "cxpvwappsasva01.brookshealth.local/" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub/

 

I also tried

RewriteEngine  on
RewriteRule "cxpvwappsasva01.brookshealth.local" http://cxpvwappsasva01.brookshealth.local:7980/SASVisualAnalyticsHub

 

I get the same results

Trusted Advisor
Posts: 1,739

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

[ Edited ]
Posted in reply to D_e_n_n_i_s

Hello @D_e_n_n_i_s,

 

too bad. Your tests make me think that perhaps your aliases are not resolving to the same IP address as the original URL? Ir even changing from IPv4 to IPv6 or the other way around?

 

You could try to do simple pings and telnet to the appropriate port. 

 

Also, probably you would need to register the alias/es in apache, in the "Listen"  line, and perhaps even new VirtualHosts - or change the VirtualHost definitions to listen on * aliases-. (specially for that CONNECTION_REFUSED error, since firewall would not be the problem here, meaning that then the only one who refuses, is Apache - the SAS Web Server)

 

Another couple of good friends, that are under my arm me since my times of J2EE developer:

 

https://httpd.apache.org/docs/2.4/vhosts/name-based.html

https://httpd.apache.org/docs/2.4/vhosts/examples.html

 

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to JuanS_OCS

Guess I need to learn more about Apache ... sigh

J2EE Developer - You must feel right at home with SAS since it uses Java to accomplish much of what it does.

Thanks for sharing your friends with us - I'll do some more research on the subject.  Thanks for all your replies - Greatly appreciated !!

Trusted Advisor
Posts: 1,739

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to D_e_n_n_i_s

General knowledge of Java or Apache definitely helps, but no need to be a programmer on it, I actually forgot a lot of stuff and I am not in the Java wave anymore - not by far, rusty

 

But perhaps a general web developer from your company can support you as well, since there is a clear common ground there!

 

Good luck, keep us posted, at least I would like to have your issue fixed soon. Pity that I cannot be there with you Smiley Wink

 

Contributor
Posts: 24

Re: Use DNS and SAS Apache to redirect a simple URL to the long VA Hub

Posted in reply to JuanS_OCS

@JuanS_OCS wrote:

Also, probably you would need to register the alias/es in apache, in the "Listen"  line, and perhaps even new VirtualHosts - or change the VirtualHost definitions to listen on * aliases-. (specially for that CONNECTION_REFUSED error, since firewall would not be the problem here, meaning that then the only one who refuses, is Apache - the SAS Web Server)

 

Another couple of good friends, that are under my arm me since my times of J2EE developer:

https://httpd.apache.org/docs/2.4/vhosts/name-based.html
https://httpd.apache.org/docs/2.4/vhosts/examples.html

 


Thanks for the tips - I'll have to research how to set up machine-name host settings and get everything registered properly.  We should have the Dev servers stood up soon so that I don't have to take down our organization while trying to get this right.  I'll keep you posted on my progress, but more research is required.

 

Thanks,

Dennis

Ask a Question
Discussion stats
  • 10 replies
  • 193 views
  • 4 likes
  • 2 in conversation