Cracked it! I had all this nonsense in my nginx from googling around. here is what worked.
location /forum { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-AUTHENTICATION, X-IP, Accept'; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } if ($request_method = 'POST') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-AUTHENTICATION, X-IP, Accept'; } if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-AUTHENTICATION, X-IP, Accept'; } add_header 'Access-Control-Allow-Credentials' 'true'; add_header X-Frame-Options "SAMEORIGIN"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; # proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto; proxy_pass http://127.0.0.1:4567; # no subfolder defined here proxy_set_header Host $host; # MAGIC proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }The masonry.js not loaded if page refreshes directly
-
Issue Description:
I use theme Lavender to have masonry effect for my Categories page. When I clicked on the navigation button to this page, the masonry effect shows correctly. However, if I refreshed the page by F5 or access directly http://localhost:4567/categories , the masonry effect wasn't applied as below.
Questions:
I want to figure out if this is problem on the plugin nodebb-theme-lavender or nodebb won't load the plugin scripts (directly load or F5) by design.Could some one give me some idea about this?
-
I think the theme wasn't updated to handle the changes to the script load order, so it is not calling
doMasonry
when the page is cold loaded. Will work on a fix, thanks for reporting. -
@baris said in The masonry.js not loaded if page refreshes directly:
doMasonry
Thanks for your update. Is it in nodebb core or in plugin nodebb-theme-lavender? I may have to fix it a.s.a.p. to solve our production problem as categary become our home page.
-
It is in nodebb-theme-lavender but I am not 100% sure if thats the problem, you can find it here https://github.com/NodeBB/nodebb-theme-lavender/blob/master/static/lib/lavender.js#L69
-
@baris Thanks. I applied a dirty fix below:
//page load or reload to doMasonry if($('.masonry').length) { doMasonry(); }
The github fork is here:
https://github.com/georgezhang/nodebb-theme-lavender/blob/master/static/lib/lavender.js -
I’ve had this problem for quite some time so happy to see a fix may occur. Thanks!