zalando / tailor

A streaming layout service for front-end microservices
http://www.mosaic9.org
MIT License
1.73k stars 140 forks source link

Required fragments #79

Closed StyleT closed 7 years ago

StyleT commented 7 years ago

Hi! Is there any way to mark some fragments as "required" so if they return error code we should return some general error page instead of broken one? This can be useful in case we want to show "Server error page" if server that server our header & footer is unavailable.

P.S.: It this behaviour makes sense for you guys I can help with a PR.

vigneshshanmugam commented 7 years ago

@StyleT Yeah its totally possible and you can mark the fragment that you want to control the status code of the page as primary

<fragment primary src="url.com"></fragment>

Not sure if this was your question..

vigneshshanmugam commented 7 years ago

and if you want to control the fragment fallback then you can also give the fallback-src if its down.

StyleT commented 7 years ago

@vigneshshanmugam problem here that header & footer fragments are not actually primary fragments. primary one in this theoretical setup with header, body & footer fragments is actually a body.

And I can't use few primary fragments on the page.

Talking about fallback-src. Great feature, but what if fallback is also broken?

vigneshshanmugam commented 7 years ago

This Should clarify the overall idea..

StyleT commented 7 years ago

@vigneshshanmugam yep, got it. But what if I want to mark some fragments in such way so if some of them (and their fallbacks too) are down we should return some general error page instead of broken one?

vigneshshanmugam commented 7 years ago

@StyleT Hmm we haven't had/thought about this case.. Because we always serve the fallback-src from a CDN ( static error html) for each fragment.. Worked always for us.. But would be happy to support it as well.

Doing the proposal that you are aiming for would require lots of bookkeeping and will need some tweaks in the way we compose streams!..

w0rm commented 7 years ago

Having the fallback of the fallback doesn't make sense to me..

vigneshshanmugam commented 7 years ago

I agree with @w0rm on this and in the end you would need to fall back to a page when your primary/required fragment is not available which is already solved in tailor.

Having required is not in scope for now, Hence closing the issue