Custom Error Pages

I’m at the point in my project where I want to create custom error pages, eg 404 and 500.

  1. Is there a best practice for this, particularly the 404? I imagine there would be something in the workflow to redirect to my custom 404 page.
  2. As for the 500, there could be unplanned down time, which I can’t figure out how WeWeb would know this, and then there could be planned down time which might be as simple as passing a variable to the system to redirect to the respective “down for maintenance” page.

What advice do you have for approaching these 2 scenarios?

1 Like

500 not sure, but 404 you can just name the path of your page.

In any way if you use WeWeb as “hosting” i don’t know.

But usually you will have a response from your source, whatever it is. And i am sure they will give an error code. That one you can bind to the path of your page.

Do you have self-hosting?

It looks like we are using WeWeb for hosting—the Self-Hosting tab still shows an add to upgrade to self-hosting.

So if I understand you correctly, you’re suggesting that as long as I have a /404 page in the app, a 404 will automatically redirect to this page? Is that right?

In contrast, I was sort of expecting WeWeb to trigger an error that I would read, for example on appLoad workflow, and redirect to said page, but things are much easier if its automatic.

Ehm, not 100% but almost.

For the 404, see here:

For 500, you need a server response, that one i dont know as well yet, but in that case you can export the code and host without using the weweb hosting, since they dont have a proper hosting in my opinion. which you are most likely doing at the moment. the only way with the self hosting i see, is that you need to avoid the weweb dependencies like stripe etc. there was somewhere in the forum about that, just can not look for it atm

1 Like

:man_facepalming: I’ve gotten so used to searching the Community for help, I forgot there was official documentation. That was helpful. Thanks!

1 Like

Well… the official docs are pretty weak and the old docs appear in google, which then gets extra confusing! I’m learning all sorts from the official YouTube channel which at least is quite active and nice to see.

I’ve noticed the forum is getting more lively from last year which is good see though :slight_smile:

Thanks for pointing that out @what.gift, appreciate it!

We’re taking steps to fix this. In the meantime, the old docs that appear in search results should be redirecting to the new ones.

Can you tell me more about why you feel the official docs are weak so we can work on improving those as well?

@Joyce, do you happen to know how 500s would be handled? For example, in the scenario where we are doing nightly scheduled maintenance and want to prevent someone from logging in during this time; would WeWeb automatically know that we are doing maintenance and redirect the visitor to a custom 500, or would we need to pass a variable into WeWeb and use that to redirect the visitor?

Boolean variable for Maintenance Mode.
Global workflow to handle the logic for showing the maintenance page that you can just create.

that’s how i made it

2 Likes