I'm not able to solve CORS issue (Openlitespeed, CloudFront, CloudFlare)

#1
Hey Guys - I recently started using OpenLiteSpeed and started loving it.

Then I started experimenting and see what's best for speed. I'm testing atm,

EC2 (AWS): WordPress site is on EC2 AWS (Openlitespeed Image)
Cloudflare: For Cache and (modifications of CSS, JS, and HTML)
CloudFront: For CDN, assuming since EC2 is on AWS, so CF will be a better choice.

After successfully installing, "Amazon AWS CDN" WordPress plugin and activating it with a custom domain, "cdn.socialchamp.io". I see my assets hitting the "CloudFront" cache however, I'm getting a CORS issue on my fonts. (Elementor Default Fonts).

This is the site, and you can see the CORS issue in the console too,
https://sameerahmedkhan.com/

What I tried so far,
> I've tried updating the "context" from Webserver but failed to see it reflected. (restarted server and purged all cache just in case)
> I've tried to make .htaccess editable and updated it with rules but that didn't work too.
> Last I did was follow, https://openlitespeed.org/kb/setting-up-cors-on-openlitespeed

sudo vi /usr/local/lsws/conf/vhosts/Example/vhconf.conf
And added,
extraHeaders Access-Control-Allow-Origin *

But that didn't work too.

This document looks outdated (maybe) because I didn't find the "Extra Headers" in OLS Web Admin hence I edited via Terminal directly.

Any idea what steps I might be missing? Thanks a ton in advance!

Thanks!
 
#3
And these were the "Context settings I created and it didn't work out. I created the 2nd file static file

1622298256770.png

And in the file,
Code:
URI: /exp: \.(ttf|woff|woff2)$
Location: $DOC_ROOT$0
Accesible: Yes
Enable Rewrite: Yes
Rewrite Rules: Header set Access-Control-Allow-Origin "*"

- And then restarted the server and purged all cache, didn't work.

I also tried these settings that didn't work too.
Code:
URI: /
Location: $DOC_ROOT/
Accesible: Yes
Enable Rewrite: Yes
Rewrite Rules: Header set Access-Control-Allow-Origin "*"
 
#6
Here's a snapshot of error.log just in case it could help tracing the problem.

Code:
2021-05-30 17:44:30.062210 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-30 17:44:30.062621 [NOTICE] [33316] [lsphp] add child process pid: 293843
2021-05-30 17:44:30.062686 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 21:12:44.635181 [NOTICE] [33316] [SSLTicket] ticketCb() SHM keys need rotation
2021-05-30 21:18:52.591521 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 21:18:52.591542 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-30 21:18:52.591626 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-30 21:18:52.592048 [NOTICE] [33316] [lsphp] add child process pid: 295451
2021-05-30 21:18:52.592134 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 21:57:31.607229 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 21:57:31.607251 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-30 21:57:31.607335 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-30 21:57:31.607728 [NOTICE] [33316] [lsphp] add child process pid: 295598
2021-05-30 21:57:31.607799 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 22:32:12.518877 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 22:32:12.518902 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-30 22:32:12.518986 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-30 22:32:12.519384 [NOTICE] [33316] [lsphp] add child process pid: 295749
2021-05-30 22:32:12.519457 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 23:44:15.703122 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-30 23:44:15.703147 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-30 23:44:15.703229 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-30 23:44:15.703661 [NOTICE] [33316] [lsphp] add child process pid: 296107
2021-05-30 23:44:15.703733 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 00:11:20.178445 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 00:11:20.178470 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 00:11:20.178550 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 00:11:20.178940 [NOTICE] [33316] [lsphp] add child process pid: 296259
2021-05-31 00:11:20.179016 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 01:14:51.100828 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 01:14:51.100847 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 01:14:51.100925 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 01:14:51.101306 [NOTICE] [33316] [lsphp] add child process pid: 296672
2021-05-31 01:14:51.101371 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 02:37:51.951952 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 02:37:51.954804 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 02:37:51.956552 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 02:37:51.961093 [NOTICE] [33316] [lsphp] add child process pid: 297528
2021-05-31 02:37:51.961158 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 02:42:44.471561 [NOTICE] [33316] [SSLTicket] ticketCb() SHM keys need rotation
2021-05-31 03:42:45.322373 [NOTICE] [33316] [SSLTicket] ticketCb() SHM keys need rotation
2021-05-31 04:40:51.025427 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 04:40:51.027214 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 04:40:51.027317 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 04:40:51.027706 [NOTICE] [33316] [lsphp] add child process pid: 298535
2021-05-31 04:40:51.027768 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 05:14:51.345424 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 05:14:51.345448 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 05:14:51.345530 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 05:14:51.345925 [NOTICE] [33316] [lsphp] add child process pid: 298684
2021-05-31 05:14:51.345995 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 05:42:50.200469 [NOTICE] [33316] [SSLTicket] ticketCb() SHM keys need rotation
2021-05-31 06:53:01.930108 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 06:53:01.930766 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 06:53:01.930856 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 06:53:01.931257 [NOTICE] [33316] [lsphp] add child process pid: 299252
2021-05-31 06:53:01.931325 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 07:29:29.302914 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 07:29:29.302952 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 07:29:29.303036 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 07:29:29.303434 [NOTICE] [33316] [lsphp] add child process pid: 299479
2021-05-31 07:29:29.303504 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 07:37:39.029964 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 07:37:39.029983 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 07:37:39.030053 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 07:37:39.030434 [NOTICE] [33316] [lsphp] add child process pid: 299511
2021-05-31 07:37:39.030490 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:02:55.478840 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:02:55.478862 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 08:02:55.478937 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 08:02:55.479333 [NOTICE] [33316] [lsphp] add child process pid: 299607
2021-05-31 08:02:55.479404 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:13:43.302986 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:13:43.303009 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 08:13:43.303087 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 08:13:43.303520 [NOTICE] [33316] [lsphp] add child process pid: 299800
2021-05-31 08:13:43.303592 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:45:54.725932 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 08:45:54.725958 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 08:45:54.726036 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 08:45:54.726444 [NOTICE] [33316] [lsphp] add child process pid: 300350
2021-05-31 08:45:54.726515 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 09:37:21.079661 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 09:37:21.079684 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 09:37:21.079759 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 09:37:21.080178 [NOTICE] [33316] [lsphp] add child process pid: 300547
2021-05-31 09:37:21.080249 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 09:47:04.096477 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 09:47:04.096496 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 09:47:04.096571 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 09:47:04.096990 [NOTICE] [33316] [lsphp] add child process pid: 300618
2021-05-31 09:47:04.097043 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:17:32.076967 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:17:32.076991 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 10:17:32.077071 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 10:17:32.077477 [NOTICE] [33316] [lsphp] add child process pid: 300816
2021-05-31 10:17:32.077545 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:34:09.939123 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:34:09.939146 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 10:34:09.939227 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 10:34:09.939609 [NOTICE] [33316] [lsphp] add child process pid: 300874
2021-05-31 10:34:09.939680 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:48:03.928858 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 10:48:03.928881 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 10:48:03.928962 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 10:48:03.929395 [NOTICE] [33316] [lsphp] add child process pid: 300940
2021-05-31 10:48:03.929453 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 11:14:07.856064 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 11:14:07.856640 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 11:14:07.856729 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 11:14:07.857130 [NOTICE] [33316] [lsphp] add child process pid: 301112
2021-05-31 11:14:07.857192 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 11:48:01.807429 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 11:48:01.807450 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 11:48:01.807533 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 11:48:01.807941 [NOTICE] [33316] [lsphp] add child process pid: 301248
2021-05-31 11:48:01.808038 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 12:18:23.496317 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 12:18:23.499227 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 12:18:23.499342 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 12:18:23.499749 [NOTICE] [33316] [lsphp] add child process pid: 301394
2021-05-31 12:18:23.499807 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 12:30:47.590743 [INFO] [33316] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 12:30:47.590765 [INFO] [33316] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-05-31 12:30:47.590901 [NOTICE] [33316] [LocalWorker::workerExec] Config[lsphp]: suExec uid 33 gid 33 cmd /usr/local/lsws/lsphp74/bin/lsphp, final uid 33 gid 33, flags: 0.
2021-05-31 12:30:47.591292 [NOTICE] [33316] [lsphp] add child process pid: 301430
2021-05-31 12:30:47.591364 [INFO] [33316] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-05-31 12:33:56.217526 [NOTICE] [33316] [110.38.30.246:62893-Q:BBFF411C9258C8E7-5#wordpress] [STDERR] PHP Warning:  strstr(): Empty needle in /var/www/html/wp-content/plugins/aws-cdn-by-wpadmin/admin/wpa-aws-configure.php on line 94
2021-05-31 12:34:01.448289 [NOTICE] [33316] [110.38.30.246:62893-Q:BBFF411C9258C8E7-41#wordpress] [STDERR] PHP Warning:  strstr(): Empty needle in /var/www/html/wp-content/plugins/aws-cdn-by-wpadmin/admin/wpa-aws-configure.php on line 94
2021-05-31 12:37:12.157397 [NOTICE] [33316] [110.38.30.246:23335:HTTP2-9#wordpress] [STDERR] PHP Warning:  strstr(): Empty needle in /var/www/html/wp-content/plugins/aws-cdn-by-wpadmin/admin/wpa-aws-configure.php on line 94
 
#9
Just an update for anyone following this thread. The team helped and found I was using the "wrong" IP address to log into the webserver. It was the webserver of my other website hence everything I did was affecting that website and not this. :(

And following this, fixed my CORS issue,
https://openlitespeed.org/kb/how-to-set-up-custom-headers/

Thank you again, and apologies for such a novice mistake :/

PS: I had been testing 4 EC2 machines and evaluating speeds by using different combinations of cache and cdn.
 
Top