How to redirect not logged in user from private page

Hi,

So I made my profile page private for every user. the url uses the a uniqueID of another orders database to populate some information on the page. for example.
site (abc.com/orders/1516378075894x974593289134103200.com)

I made it so that when page loads, if user is not logged in, go to login page. However, for a brief second, you are able to see the information on abc.com/orders/1516378075894x974593289134103200.com before it is quickly redirected. How do i make it so the page does not even render but redirects immediately?

IMO, I don’t think there is a straight shot way without load-speed. This is why I don’t use Bubble anymore for my own personal applications. You always have to wait until the page is loaded, then can do the action. With more modern applications/builders you can implement features before the page loads, which is ideal these days.

First make sure that you set up privacy rules and only load the order data if the user is current user.

Another workaround to this is use an empty router page, this page controls the routing of your app and it redirects the user to the desired page(s).

1 Like

You can get a 302 redirect if using a page is loaded workflow, putting conditions on the workflow (not the workflow actions) and not referencing anything from the page in the condition. This allows the redirect to come from the server rather than the client.

You can test by going to this page: Bubble | No-code apps

You can check the redirect by pasting that url here: Redirect Checker | Check your Statuscode 301 vs 302

Editor: public-tests | Bubble Editor

2 Likes

Yes but dynamically is the challenge.

Do what dynamically?

Create 301 redirects and make it so you don’t have to manually add each one.

Well the conditions are dynamic and the workflow can be placed in a reusable in the header. But I don’t come from a traditional programming background so idk, maybe this is cumbersome compared to the normal way of doing it

2 Likes

Lots of relevant details in How to properly implement conditional redirects?

1 Like

No worries mate. I am way ahead on the Coding side than no-code. With Bubble, you do not really have access to how your page is rendered or behaves before it is rendered. With my techniques, I do.

This is an example:

This is middleware. I can completely change the way how routing acts before it happens. Bubble does not have this capability in any way shape or form.

This is what the routes look like:

As you can see I can redirect before anything renders.

@GH5T it’s awesome to have someone with your experience in the community and i think your plugins are awesome too.

Though i think it’s better for new users if you do not keep pushing people away from Bubble and to instead suggest it as an alternative after providing a native solution.

I think the forum has enough threads specifically about alternatives. :slight_smile:

1 Like

You’re right, I do fickle about utilizing frameworks outside of Bubble, but that’s just to prove that Bubble is not always the answer for specific use-cases.

This is just an example of what we cannot do with Bubble. I am only providing this insight to show that he won’t be able to achieve the instant effect that he wants (as of now) but can do so with some alternative options like Creating your own slugs without a page - Tips - Bubble Forum. This follows the same principal, with animation and redirection.

I have helped many others with setting up routes on Bubble itself, and so far one of the only apps that has really done it right is https://whisperer.hu/ (as far as routing concerns).

If you want this type of effect you can easily do so with my PathHopper feature included inside my Toolkit. Though this is not ideal for redirects, but for routing. With it however, you can detect a certain path and redirect as needed. But I’m sure there may be a faster method (included in my video I believe) for redirection purposes.

Him and I are also going to be collaborating on an easier method in which you’ll be able to do it with your home page (still wont be dynamic but will load instantly).

1 Like

Instead of when page loads use when user logged out.

This topic was automatically closed after 70 days. New replies are no longer allowed.