Skip to content

Commit

Permalink
Adjust AIO SSR configuration, handle gzip payload (#903)
Browse files Browse the repository at this point in the history
Co-authored-by: Cezary Czernecki <czerneck@adobe.com>
Co-authored-by: Hanish Bansal <38317539+habansal@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 9, 2022
1 parent 122c6c3 commit ddf347c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"getRemoteHTMLRendererUrl" : "http://localhost:3233/api/v1/web/guest/${appId}-0.1.0/ssr",
"getRequestTimeout": 10000,
"getAdditionalRequestHeaders": [

]

],
"getCompression": "none"
}
3 changes: 3 additions & 0 deletions src/main/archetype/ui.frontend.react/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ REACT_APP_ROOT=/content/${appId}/${country}/${language}/home.html
AIO_RUNTIME_NAMESPACE=guest
AIO_RUNTIME_AUTH=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
AIO_RUNTIME_APIHOST=http://localhost:3233
OW_NAMESPACE=guest
OW_AUTH=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
OW_APIHOST=http://localhost:3233
#end
10 changes: 8 additions & 2 deletions src/main/archetype/ui.frontend.react/actions/ssr/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
require("regenerator-runtime/runtime");
const processor = require('../common/app');
const pako = require('pako');

async function main(args) {

var data;
if (args.__ow_headers['content-type'] === "application/octet-stream") {
data = Buffer.from(pako.inflate(Buffer.from(args.__ow_body, 'base64')), "base64").toString()
} else {
data = args
}

const refinedArgs = {
data: args,
data: data,
pageRoot: args.__ow_headers['page-model-root-url'],
pagePath: args.__ow_path,
wcmmode: args.__ow_headers['wcm-mode']
Expand Down
3 changes: 2 additions & 1 deletion src/main/archetype/ui.frontend.react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@adobe/aio-sdk": "^3.0.0",
"minimist": "^1.2.0",
"node-fetch": "^2.6.0",
"pako": "^2.0.4",
"react-fast-compare": "^3.0.1",
"react-router": "^5.1.2",
"regenerator-runtime": "^0.13.7",
Expand All @@ -43,7 +44,7 @@
#if ( $enableSSR == "y")
"cross-env": "^7.0.3",
"@adobe/aio-cli": "^8.2.0",
"@adobe/wskdebug": "^1.1.3",
"@openwhisk/wskdebug": "^1.3.0",
"babel-core": "^6.26.2",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var isTestEnvironment = process.env.NODE_ENV == 'test';

const serverConfig = {
// Tell webpack to start bundling our app at app/index.js
entry: ['babel-polyfill', './src/server/aem-processor.js'],
entry: ['./src/server/aem-processor.js'],
target: 'node',
externals: nodeExternals({
whitelist: [
Expand Down

0 comments on commit ddf347c

Please sign in to comment.