Commit451/skyhook

Support for hosting on `non root URL`

alex-ong opened this issue · 11 comments

I host at website.com/skyhook/ rather than say website.com:8080/

It fails for several reasons

  • Some files don't load
    • copyToClipboard.min.js
    • client.js
    • favicon.ico

As a result when it generates the url, it might actually do it successfully, but it can't copy it to clipboard.

As a workaround i'm hosting it on website.com:8080.

you cant do skyhook.website.com?

Nope, because I'm on subdomain.main.com. I own subdomain, and I don't think there's a subsubdomain.subdomain.domain.com

To save time, how can I reproduce this locally?

Hi,

I was using apache to forward from mysub.company.com/skyhook/ to 10.0.1.2/
(This fails to load those three files)
It works if I do
Mysub.company.com:8080 to 10.0.1.2

Maybe I had an apache problem? But just doing that caused those three files to fail… since it tries to load them relatively. I can try to get a repro above. If you think it's purely an apache problem let me know, but I've gotten confluence and other services to work using the same forwarding method.

So I'm assuming the issue is the relative paths. Can you edit the paths in index.js to be (example) ./skyhook/copyToClipboard.min.js instead? I'm not really sure if we can do anything off the main branch to do this, besides maybe setup an environment variable and inject it via ejs?

Try it out

Another good point.. where are the files hosted with the redirect? Are they still at the url root?

Hi,

Sorry for slow response! going to give it a shot now...
This is the error for hosting on subdomain.domain.com/skyhook/ (apache forwards to 10.0.1.2:8080).
Will do the changes you suggested and see how it goes
image

All fixed according to your guidances

index.ejs
@@ -12,7 +12,7 @@
             integrity="sha384-zYyxh4r8CWy0xvG1ua+/rTeQmFY/YhmqzzaqluuGnN9+fCFSj/jF1AwiW9p+KUW/"
             crossorigin="anonymous">
     <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
-    <link rel="stylesheet" type="text/css" href="style.css">
+    <link rel="stylesheet" type="text/css" href="./skyhook/style.css">
 </head>
 <header class="mdc-top-app-bar mdc-top-app-bar--fixed" style="position: relative;">
     <div class="mdc-top-app-bar__row">
@@ -88,6 +88,6 @@
 <script src="https://code.jquery.com/jquery-3.6.0.min.js"
         integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
         crossorigin="anonymous"></script>
-<script src="./client.js"></script>
+<script src="./skyhook/client.js"></script>

The clipboard error disappeared since you upgraded (2 days ago!) to using an externally referenced clipboard.js. So i only had to change the .css and client.js references. If this could be some environment variable or such that would be great!

Yea potentially, could you lmk what you changed it to exactly?

Yea potentially, could you lmk what you changed it to exactly?

It was above in the poorly formatted diff.

./client.js -> .endpath/client.js
style.css -> .endpath/style.css

Both in index.ejs

Changing those two was all I needed

Just added a way to do this without modifying the code, set the environment variable HOST_PATH. If your url is /skyhook, then use that as the value. If hosting at the root, you can either leave this blank or set it to /.

This can be set easily in the .env. Ex.

HOST_PATH = /skyhook

Feel free to reopen if anything breaks.