Question
· Nov 28, 2018

How can I have HealthShare respect relative paths for javascript and css files that are referenced in the index.html file?

I am new to InterSystems.

I have set up a simple application in HealthShare.

Name: /testwebapp
CSP Files Physical Path: /Users/lakinducker/Documents/Dev/testwebapp/dist/testwebapp

In that directory are the following:
index.html
styles.3bb2a9d4949b7dc120a9.css
polyfills.c6871e56cb80756a5498.js
main.4ba7035983a7e3311083.js
runtime.ec2944dd8b20ec099bf3.js
favicon.ico
3rdpartylicenses.txt

If I go to http://localhost:57772/testwebapp, I get "Not found".

If I go to http://localhost:57772/testwebapp/index.html, I get the index.html file. However, it fails to get any of the javascript or css files that are referenced in the index.html.

In fact, I can see that it is trying to get them at..
http://localhost:57772/styles.3bb2a9d4949b7dc120a9.css

and not at...
http://localhost:57772/testwebapp/styles.3bb2a9d4949b7dc120a9.css

I am confused by this. There probably is a creative way to get around this. However, this is so strange to me, being someone new to InterSystems, that I thought I should ask.

Why is this happening? What do I need to change?

Discussion (9)1
Log in or sign up to continue

If I go to http://localhost:57772/testwebapp, I get "Not found".

Yes, this is expected. The private instance of Apache which HealthShare runs on your port 57772 isn't set up to serve 'default' page(s).

As for your relative path problem, please show us what your index.html file looks like. Simplify it if you wish, but make sure you don't fix the problem as you do so!

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Testwebapp</title>
    <base href="/">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <link rel="stylesheet" href="styles.3bb2a9d4949b7dc120a9.css">
</head>

<body>
     <app-root></app-root>
<script type="text/javascript" src="runtime.ec2944dd8b20ec099bf3.js"></script><script type="text/javascript" src="polyfills.c6871e56cb80756a5498.js"></script><script type="text/javascript" src="main.4ba7035983a7e3311083.js"></script>
</body
</html>