Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Refactor Helix Flow to give Content Repository Precedence for all Request #96

Closed
trieloff opened this issue May 16, 2019 · 4 comments
Closed
Assignees
Labels
question Further information is requested released

Comments

@trieloff
Copy link
Contributor

trieloff commented May 16, 2019

I've been discussing this with @davidnuescheler and since we have the new drawings in docs (https://github.com/adobe/helix-publish/tree/master/docs), I can outline the change I'd like to achieve.

Old:

Helix Flow@2x

New:

Helix Flow New@2x

What changes:

  1. all normal requests get the raw request type first (this used to be called `image)
  2. only when the extension is supported by the image optimizer, we will enable image optimization
  3. otherwise the raw request type works like the old image type, it tries to fetch the content directly from the content repository, even when it is a html, js, or css file.
  • this means you can create a static index.html and get it served @filmaj
  • this means you can have custom CSS for Helix Pages @koraa and @kptdobe
  • this means you can have a 404.html @tripodsan @ramboz (but more about that later)
  1. when this request (which is very cheap for us) fails, we fall back to the regular pipeline request type, i.e. try to call the runtime action.
  • note: the most frequent failure cases, i.e. no action for css, js, etc. is very cheap and fast for us, because no action gets called
  1. when the pipeline request fails, we fall back to static, which can (as before yield content, or a redirect, or a static_url, each with a restart.
  2. when that request fails, we start a new request type error, which changes the internal URL to 404.html and tries to get it from the content repository

Examples of requests and resolution:

Request Content repo Static repo Comment
/index.html index.md ✅ Default md processing
/index.html index.html ✅; index.md Static html file stronger than md processed file
/index.html index.html ✅ index.html
/index.html index.html ✅ htdocs/index.html
/index.html htdocs/index.html ✅
/index.html htdocs/index.md : ❌ 404 - no pipeline processing from static
/index.html index.html : ❌ 404 - static action mapped to htdocs
/style.css htdocs/style.css ✅ Default style handling
/style.css style.css ✅ Strange but supported
/style.css style.css ✅ htdocs/style.css Style override inside content repo
@trieloff trieloff added the question Further information is requested label May 16, 2019
@trieloff
Copy link
Contributor Author

This is the maximum number of restarts (3) that Fastly supports, so going back to static for 404.html is not an option.

@kptdobe
Copy link
Contributor

kptdobe commented Jun 4, 2019

If I summarise, each request will go through: content repo via raw API -> content repo via pipeline action -> static repo via static action via raw API

It would be great to create an exhaustive list of all the cases we want to support (especially with the overrides) and check if they are covered by this new flow.

In step 6, isn't possible to do a redirect to 404.html (something like changing the external url) which would follow the same complete logic ? (treated like a normal request).

@trieloff
Copy link
Contributor Author

trieloff commented Jun 4, 2019

Yes, we could redirect instead of restarting for 404.html, but I'd like to avoid this because it will mask all 404 errors as 301 or 302 non-errors.

trieloff added a commit that referenced this issue Jun 24, 2019
Yet another stab at #96 and adobe/helix-pipeline#365 (based on, but conflicting with #105). This one uses the new `helix-experimental-dispatch` action instead of restarts, adding some overhead to the first request (about 20ms), but having much better worst-case performance due to parallel execution.

fixes #96
@trieloff trieloff mentioned this issue Jun 24, 2019
4 tasks
adobe-bot pushed a commit that referenced this issue Jun 26, 2019
# [2.0.0](v1.0.3...v2.0.0) (2019-06-26)

### Bug Fixes

* **error:** fix remaining resp ([d89b2f6](d89b2f6))
* **error:** separate error handler from raw handler ([00beb7a](00beb7a))
* **error:** use http.host ([03b4ec3](03b4ec3))
* **error:** use new error subroutin ([29cac81](29cac81))
* **error:** use resp instead of beresp in error delivery ([dab068b](dab068b))
* **package:** add missing error pages ([ebcf05c](ebcf05c))
* **raw:** set correct content type for popular file endings ([1455d3f](1455d3f))
* **raw:** set correct content type for raw HTML responses ([fafd955](fafd955))
* **static:** use the versioned shared static function ([2e18192](2e18192))
* **vcl:** add missing equals sign for request parameters ([c238503](c238503))
* **vcl:** always use HTML for error pages ([dec8b51](dec8b51))
* **vcl:** fix data flow error ([22897d1](22897d1))
* **vcl:** fix req.http.X-Action-Root ([c6c7e7d](c6c7e7d))
* **vcl:** fix syntax error ([e28ec3d](e28ec3d))
* **vcl:** fix syntax error ([6825bae](6825bae))
* **vcl:** fix syntax error ([1fe37f2](1fe37f2))
* **vcl:** fix syntax error ([b0b9829](b0b9829))
* **vcl:** fix syntax error ([ebf0807](ebf0807))
* **vcl:** fix syntax error ([d8afe05](d8afe05))
* **vcl:** move error from fetch to deliver ([061fa10](061fa10))
* **vcl:** relax conditions for 302 and url extensions ([8da5e1e](8da5e1e))
* **vcl:** remove error request type ([9c72d4b](9c72d4b))
* **vcl:** remove unused error subroutine ([a58e8e0](a58e8e0))
* **vcl:** remove unused raw function ([9fb2e05](9fb2e05))
* **vcl:** remove unused subroutines ([1cbdec4](1cbdec4))
* **vcl:** shut up chatty headers ([31fcc7c](31fcc7c))
* **vlc:** don't drop out of error handler function ([35a9f81](35a9f81))

### Features

* **static:** Give content repository precedence in serving resources and error pages ([bf8cbae](bf8cbae)), closes [#96](#96)
* **vcl:** introduce new dispatch flow ([53a3dbe](53a3dbe)), closes [#96](#96) [#105](#105) [#96](#96)

### BREAKING CHANGES

* **static:** As described in #96, this introduces a new request type `raw` which works like the old `image` request type, but applies to all resources. In case `raw` fails, we will fall back to `pipeline`, which will fall back to `static` which will fall back to `error`. `error` is very similar to `raw` in that it tries to fetch an error page like `404.html` from the content repository
@adobe-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested released
Projects
None yet
Development

No branches or pull requests

3 participants