Broken links when accessing Canvas through AWS "distribution"

57 views
Skip to first unread message

Grzegorz Tarnowski

unread,
Sep 26, 2022, 11:26:53 AM9/26/22
to Canvas LMS Users
Does anybody have an experience deploying Canvas on AWS Lightsail?
I'm struggling with configuring canvas config and domain.yml - I always get broken links while accessing canvas via https;//domainname.cloudfrontetc... Also file uploading and invitation links don't work correctly.
It seems my problem is similar to the one described here https://groups.google.com/u/1/g/canvas-lms-users/c/AKabdzKQL_k/m/WeTjATI-AwAJ (deep linking issues). My server OS is ubuntu 18.04 with Apache, not IIS though...

Greg
image (1).png

image.png
image (2).png
image (3).png

Samuel Santhosh

unread,
Sep 27, 2022, 1:49:14 AM9/27/22
to Canvas LMS Users
Hi,

I think the avatar image is cached you can try clearing the redis cache.
And If you share the console messages for "loading more results..." issue, It will be helpful.

Iván García

unread,
Sep 27, 2022, 10:24:39 AM9/27/22
to Canvas LMS Users
Hello,

Remember to review the Canvas Production Start documentation, especially this part: https://github.com/instructure/canvas-lms/wiki/Production-Start#url-configuration

Hope this helps.

Regards.

Grzegorz Tarnowski

unread,
Sep 27, 2022, 1:14:04 PM9/27/22
to Canvas LMS Users
Thanks Samuel, clearing the Redis cache solved the problem. 
When I go to the files page, I get "mixed contents" critical errors in the console.
I tried adding <IfModule mod_headers.c> Header always set Content-Security-Policy "upgrade-insecure-requests;" </IfModule> in canvas.conf but it didn't help.

Grzegorz Tarnowski

unread,
Sep 27, 2022, 1:34:06 PM9/27/22
to Canvas LMS Users
Now i'm trying to do this (but on Apache)
forward proxy with x_forwarded_proto header.CloudFront (same protocol) > nginx (with header x_forwarded_proto[https])(443 or 80) > canvas application (80)

Grzegorz Tarnowski

unread,
Sep 27, 2022, 11:48:59 PM9/27/22
to Canvas LMS Users
It works! This is what I did:

0. sudo a2enmod headers to install/enable mod_headers
1 Added RequestHeader set X-Forwarded-Proto https in canvas.conf, inside of <VirtualHost>
2. changed the domain name in domain.yml to <numbersandletters>.cloudfront.net
3. cleared browser cache
4. sudo /etc/init.d/apache2 restart && sudo /etc/init.d/canvas_init restart

Thanks!

Iván García

unread,
Sep 28, 2022, 9:51:04 AM9/28/22
to Canvas LMS Users
Nice! Great work! Sometimes you just must force the recognition that the site is used by https.

By the way, do you mind sharing what's your CloudFront Behaviors? I always wanted to put Canvas behind it but I did not find any information of what to cache or do not cache. Thanks.

Kind regards.

Grzegorz Tarnowski

unread,
Sep 28, 2022, 10:56:55 AM9/28/22
to Canvas LMS Users
I'm using the preset "best for dynamic sites". According to the info on AWS website, this means nothing is cached. While facing the issue with links,  I tried custom settings in order to get access to the headers,  but it didn't help...

Greg

Iván García

unread,
Oct 4, 2022, 10:42:31 AM10/4/22
to Canvas LMS Users
Thank you Greg,

I also ran some tests but could not find a pattern of what to cache.

Kind regards.

Reply all
Reply to author
Forward
0 new messages