Prerender: Request Forwarding (High Level) - NCIOCPL/cgov-digital-platform GitHub Wiki
General Case
- A bot requests an application page, (e.g. a definition for "carcinoma")
- An Akamai rule detects that the path is eligible for prerendering and forwards the request to the prerender service.
- The prerender service makes a new request for the page, appearing as a standard user.
- The application (e.g. the glossary application) returns the page.
- The prerender service executes the page logic and returns the generated HTML to Akamai.
- The bot receives the generated HTML in response to the original request.
sequenceDiagram
participant GoogleBing
participant Akamai1 as Akamai
participant Prerender
participant Akamai2 as Akamai
participant Drupal
GoogleBing-->>+Akamai1: Request as GoogleBing
Akamai1-->>+Prerender: (forward)
Prerender-->>+Akamai2: Request as standard user
Akamai2-->>+Drupal: (forward)
Drupal-->>-Akamai2: Application page
Akamai2-->>-Prerender: (return)
Prerender-->Prerender: Execute Application
Prerender-->>-Akamai1: Static HTML
Akamai1-->>-GoogleBing: (return)
Error Handling
Page Not Found
- A bot requests an application page which does not exist (e.g. a definition for "Qwertium")
- An Akamai rule detects that the path is generally eligible for prerendering and forwards the request to the prerender service.
- The prerender service makes a new request for the page, appearing as a standard user.
- The application (e.g. the glossary application) determines the page should not exist and outputs the tag
<meta name="prerender-status-code" content="404" data-react-helmet="true">
.
- The prerender service detects the tag and returns a 404 status to Akamai.
- Akamai detects the 404 status and triggers the "Fancy 404" rule.
- The bot receives a 404 status in response to the original request.
sequenceDiagram
participant GoogleBing
participant Akamai1 as Akamai
participant Prerender
participant Akamai2 as Akamai
participant Drupal
GoogleBing-->>+Akamai1: Request as GoogleBing
Akamai1-->>+Prerender: (forward)
Prerender-->>+Akamai2: Request as standard user
Akamai2-->>+Drupal: (forward)
Drupal-->>-Akamai2: Application page
Akamai2-->>-Prerender: (return)
Prerender-->Prerender: Execute Application
Prerender-->Prerender: prerender-status-code set to 404
Prerender-->>-Akamai1: 404 status code
Akamai1-->Akamai1: Fancy 404 message
Akamai1-->>-GoogleBing: (return)
Related
Dictionary Request Forwarding