cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Embedding html file gets unauthorized error a day later

Jump to solution

I am trying to embed an html file so that links can open in a new window. I have an html file uploaded to my “files”, and what I do is I preview the file, view frame source, copy the url, and embed that url in an iframe on a new page set to the front page.

Initially, it works great but then the next day I came back to it and got the following error message: “UNAUTHORIZED: Access to this page is limited to authorized users. You do not currently have permission to view this page."

The html file and the page on which it is embedded are published and there are no other permissions that could be changed, so my question is: is there a way to guarantee this doesn’t happen so that the embedded html page will always appear as it should?

The url changes day-to-day. For example, one day the url is: https://cluster61-files.instructure.com/files/9605~1162406/download?inline=1&sf_verifier=eyJ0eXA... 

The next day the url is: https://a9605-1162406.cluster61.canvas-user-content.com/courses/9605~14011/files/9605~1162406/course... 

Assuming that the problem is related to this changing url, is there a way to get a stable url that can be embedded the way I want to?

1 Solution

Accepted Solutions
Community Coach
Community Coach

Hi vbeaver@sju.edu,

Looking at the URLs you have mentioned, it appears the URL has a time-limited authorization component (which is why it would be locking out periodically).

We tried to do this at our institution and came to the conclusion that the files area never really seemed intended to host and serve HTML files, and hence we opted to store them on a dedicated AWS instance set up for this purpose.

I therefore (unfortunately) don't have any good news I can share with you, but did want to share our experiences as we did back and forth a bit trying to get it reliably working and never succeeded.

Hope that info helps.

Cheers,
Stuart

View solution in original post

3 Replies
Community Coach
Community Coach

Hi vbeaver@sju.edu.  I don't know the answer to your question, but I am going to share this with the Canvas Developers user group in hopes that someone who is a part of that group has run into something similar or can provide insight into a possible solution. 

All the best!  

Community Coach
Community Coach

Hi vbeaver@sju.edu,

Looking at the URLs you have mentioned, it appears the URL has a time-limited authorization component (which is why it would be locking out periodically).

We tried to do this at our institution and came to the conclusion that the files area never really seemed intended to host and serve HTML files, and hence we opted to store them on a dedicated AWS instance set up for this purpose.

I therefore (unfortunately) don't have any good news I can share with you, but did want to share our experiences as we did back and forth a bit trying to get it reliably working and never succeeded.

Hope that info helps.

Cheers,
Stuart

View solution in original post

Learner II

Try simply linking to the file with:

   /files/file_id/download

For example, yours is probably:

   /files/1162406/download

When clicked, Canvas will then re-direct your browser to the currently correct location.

If you do it with the editor it will probably get changed to:

   https://your_server/courses/course_id/files/file_id/download

For example, yours is probably:

   https://your_server/courses/14011/files/1162406/download

To get the file_ids, you can just look at the URL you see when you move your mouse over the files, or put the following in your browser to see the list of files, their ids  and their URLs:

    https://your_server/api/v1/courses/course_id/files 

For the URL, you probably want to leave off the ?download_frd=1