swissup / module-upward-connector

swissup/module-upward-connector

Magento module used for routing all frontend requests through UPWARD-PHP. Wrapper for magento/module-upward-connector

magento2-module Compatibility: 2.4.7 Code Quality: Fail Tests: N/A Security: Pass OSL-3.0, AFL-3.0

Swissup 2 UPWARD connector module

The Swissup 2 UPWARD connector extends and fix some functionatity of Magento 2 UPWARD connector.
The Magento 2 UPWARD connector is a module for routing requests to UPWARD-PHP. This module replaces the default Magento frontend theme with a PWA Studio storefront application.
PWA Studio storefront deployments in the Magento Commerce use this module to keep Magento and storefront code on the same server.

Contents

  1. Installation
  2. Configuration

Installation

cd <magento_root>
composer config minimum-stability dev
composer config prefer-stable true
composer require swissup/module-upward-connector
composer config minimum-stability stable

bin/magento module:enable $(bin/magento module:status --disabled | grep 'Swissup_Core\|Pwa\|Aux\|Upward' | tr '\r\n' ' ')

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
bin/magento cache:clean

Configuration

The Magento 2 UPWARD connector has additional settings that can be configured in the admin area under:

Stores > Configuration > General > Web > UPWARD PWA Configuration.

UPWARD Config File

This configuration is the location of the UPWARD configuration file for the UPWARD-PHP server.

This module adds a new directive to the env.php to securely set the path to the upward.yaml file.

    // ...
    'downloadable_domains' => [
        // ...
    ],
    # New configuration point
    'pwa_path' => [
        'default' => [
            'default' => '/var/www/html/pwa/dist/upward.yml'
        ],
        'website' => [
            '<website_code>' => '/var/www/html/anotherpwa/dist/upward.yml' # Can point a website to a different installation
        ],
        'store' => [
            '<store_code>' => '' # Blank string (or false) to serve default Magento storefront
        ]
    ]

For ease of use, this module provides a new command for setting the path

# Set the default scope to an empty string (will serve base Magento store front)
bin/magento pwa:upward:set

# Set the website with code <website_code> to /var/www/html/pwa/dist/upward.yml
bin/magento pwa:upward:set --path /var/www/html/pwa/dist/upward.yml --scopeType website --scopeCode <website_code>

# Set the website with code <website_code> to an empty string (will serve base Magento store front)
bin/magento pwa:upward:set --scopeType website --scopeCode <website_code>

# Set the website with code <store_code> to /var/www/html/pwa/dist/upward.yml
bin/magento pwa:upward:set --path /var/www/html/pwa/dist/upward.yml --scopeType store --scopeCode <store_code>

You can use bin/magento store:list or bin/magento store:website:list to easily get the store/website code for configuration.

You may use a path relative to your web root or an absolute path for the value of this configuration.

  • Relative: pwa/dist/upward.yml
  • Absolute: /var/www/html/pwa/dist/upward.yml

If you have previously configured the UPWARD yaml path using the config:set command or environment variables, it will continue to work as a fallback, so long as no
default has been set as per the example above.

The configuration works the same way normal store configurations work. It falls back from store view > website > global (default),
trying to serve the more specific available scope first.

Front Name Allowlist

This configuration allows you to specify a line-separated list of routes to forward to the default Magento theme.

Example:

contact
privacy-policy-cookie-restriction-mode

With this example, when a visitor navigates to either <Magento store URL>/contact or <Magento store URL>/privacy-policy-cookie-restriction-mode, they will land on a page rendered by Magento instead of the storefront application.

Prerender.io Configuration

Prerender.io support in the upward-connector module allows your site to send prerendered static html to search bots.

A middleware layer checks each request to see if it comes from a crawler and if allowed, sends it to the prerender service.
These configuration entries let you configure which pages to send to Prerender.io to serve the static HTML versions of that page.
If a page is not configured for prerendering, the request continues using the normal server routes.

Configuration Description Example
Enable Prerender For Search Bots This enables prerender functionality for this store view.
Prerender URL Url of the prerender service. https://service.prerender.io/
Prerender.io Token Token to use for the prenderer.io hosted service
Crawler User Agents Line break separated list of keywords to detect the crawler in the user-agent request header
Blocked List Resources that will not be sent for prerendering. Use * as a wildcard character. .js */cart
Allowed List Explicitly allowed resources to be sent for prerendering. If empty, all resources are allowed.

Testing prerendered pages

To see how a crawler sees a prerendered page, set your browser's User Agent to Googlebot and visit your URL.
You can also run this on the command line and change the sample URL to your storefront's URL:

curl -A Googlebot https://www.example.com/ > page.html

To configure prerender locally for testing purposes, see https://docs.prerender.io/test-it/.

Troubleshooting partial rendered pages

There is no way to tell when a PWA page fully loads.
For prerendering it is possible to force prerender to wait for a predefined timeout before setting the window.prerenderReady flag.

Add the following to the runtime script:

window.prerenderReady = false;
setTimeout(function () {
  window.prerenderReady = true;
}, 1000 * 15);

For more information, see https://docs.prerender.io/test-it/.

Service Worker Note

Avoid sharing the same hostname between your PWA Studio storefront and the Magento 2 admin backend.
This causes the storefront Service Worker to intercept backend requests when you have both the storefront and admin tabs open at the same time on your browser.
If you cannot avoid sharing the hostname, access one service at a time or use a private browsing session per service.

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
1.1.4 stable Fail Magento 2.4.7 Details 2024-05-02 14:23:03
1.1.3 stable Not tested Not yet tested Details 2024-01-30 11:15:37
1.1.2 stable Not tested Not yet tested Details 2024-01-11 10:47:10
1.1.1 stable Not tested Not yet tested Details 2022-07-06 12:25:12
1.1.0 stable Not tested Not yet tested Details 2022-05-18 13:19:14
1.0.0 stable Not tested Not yet tested Details 2022-05-18 11:59:26

Requires 15

Package Constraint
php ~8.1.0||~8.2.0||~8.3.0
magento/module-upward-connector *
magento/pwa *
magento/framework *
magento/upward *
magento/module-config *
magento/module-store *
magento/module-catalog *
magento/module-cms *
magento/module-url-rewrite *
magento/module-url-rewrite-graph-ql *
magento/module-catalog-url-rewrite-graph-ql *
swissup/module-core ^1.12.19
swissup/module-pwa-studio-integration ^1.0.0
yireo/magento2-disable-service-worker-in-admin ^0.0.2

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 not tested not tested
2.4.9 not tested not tested

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 3 3 warnings (ruleset: Magento2)
PHPMD Warning 3 3 rule violations (MissingImport:3)
Cpd Pass 0
Composer validate Info 12 valid; 12 advisory notes (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 42 42
2.4.8 42 N/A
2.4.9 N/A N/A

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
OSL-3.0, AFL-3.0

More from swissup

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.