SAS VIYA Guide

Hosting a static web page on a SAS Viya server

Simon 30/04/2023 9 views

When discovering the SAS© Viya environment, especially through PDC (Personal Deployment Context) type deployment images, it is common to want to test custom interactions with the CAS server.

A classic use case is to develop a small web application (in HTML/AngularJS for example) to view or manipulate data loaded into memory. However, once your HTML file is created, you still need to know where to place it to make it accessible via a web browser.

The Common Mistake: The User Directory

The first instinct is often to use SAS© Studio to upload HTML files directly into the usual working directory, for example: /home/sasdemo/test.

Once the file is in place, you naturally try to access it via a URL like: http://sasserver.demo.sas©.com/home/sasdemo/test/ma-page.html

Result: It doesn't work. The web server usually returns an error or simply can't find the page.

Why?

The web server (HTTP Server) that manages the SAS© Viya interface is configured to serve files from specific directories. For obvious security reasons, it does not have default access to users' home directories (/home/...).

The Solution: The Web Server's Root Directory

For your HTML page to be publicly visible via the server's URL, it must reside in the web server's root directory (Document Root). On standard images (Linux with Apache/Nginx), this path is usually:

/var/www/html

The Step-by-Step Procedure

  1. Root access required: Writing to /var/www/html requires elevated privileges. You probably won't be able to do it through a simple standard file upload interface. You will need terminal access with root or sudo rights.

  2. File Placement: Move your folder or HTML files to this directory.

    • Physical path example: /var/www/html/mon-app/index.html

Understanding URL Mapping

Once the file is placed in the correct system directory, the URL to access it is derived directly from the folder structure, without including /var/www/html.

If you placed your file here:

/var/www/html/test/dashboard.html

Your access URL will be:

https://sasserver.demo.sas©.com/test/dashboard.html

If you are developing a front-end interface to interact with CAS on a demonstration image:

  1. Do not leave your web files in /home/sasdemo.

  2. Move them to /var/www/html (or the directory configured as DocumentRoot).

  3. Access them via your server's root URL.