How to redirect to login page from protected webpages

I want to authenticate a user before they access a few .html pages that should only be seen when logged in. Right now I have been making a GET request to my backend to complete this, but the process takes a little bit of time and the webpage does end up loading and flashes its content for about a half second before the server realizes its a non-authenticated user and starts redirecting. is there a more secure/better way to handle this?

Previous reply has been deleted because of SPAM reasons.

do you have any suggestions konrad?

Hey there,

Thought someone else will pick it up. I just assigned myself to it. Let me dive into that and let you know what fix you can apply!

Hey there!

Sorry for the delay in response but I must have missed it among other topics. I managed to discuss that with appropriate team but in oder to provide you with more help we need more context and info about your usecase plus steps you’ve taken regarding the technical side of it. Thank you! And once more sorry for such delayed response!