App proxy
Answer a shopper’s request for a page under the shop’s address.
import { ... } from '@storeware/plugin-sdk';verifyProxyRequest
Verifies a request Storeware forwarded from a shop's /apps/<slug>/ path and returns what it was for.
function verifyProxyRequest(options: VerifyProxyOptions): Promise<ProxyRequest>ProxyRequest
What a verified proxy request was for.
| Name | Type | Description |
|---|---|---|
method | 'GET' | 'POST' | |
path | string | After /apps/<slug>, starting with /. / is your app's root page. |
query | string | The query, without its ?. Parse it with new URLSearchParams(query). |
shop | string | The hostname the shopper used, one of the shop's own. |
pathPrefix | string | /apps/<slug>, for building links and form actions back to yourself. |
storeId | string |
VerifyProxyOptions
| Name | Type | Description |
|---|---|---|
proxyHeader | string | null | undefined | The storeware-proxy header, exactly as received. |
rawBody? | string | ArrayBuffer | Uint8Array | The body exactly as received, or empty for a GET. A multipart form may hold bytes that are not text, so pass await request.arrayBuffer(). |
secret | string | The secret handed to your plugin when a merchant installed it. |
signatureHeader | string | null | undefined | |
toleranceSeconds? | number | undefined | |
nowSeconds? | number | undefined |
PROXY_HEADER
The header that carries what Storeware signed.
const PROXY_HEADER: 'storeware-proxy'