2026-05-13 22:34:11 +02:00
2026-05-13 22:34:11 +02:00
2026-05-13 22:34:11 +02:00
2026-05-12 11:25:32 +02:00
2026-05-12 11:25:32 +02:00
2026-05-12 01:13:01 +02:00
2026-05-13 22:34:11 +02:00
2026-05-12 09:19:54 +02:00
2026-05-12 01:13:01 +02:00
2026-05-12 09:19:54 +02:00
2026-05-12 05:10:30 +02:00
2026-05-12 01:13:01 +02:00
2026-05-12 05:10:30 +02:00
2026-05-13 22:34:11 +02:00
2026-05-12 01:13:01 +02:00

PrestaProxy

Go reverse proxy in front of PrestaShop 1.7.3 with:

  • Echo as the HTTP server
  • native Go PrestaShop cookie decode/encode
  • templ for HTML rendering
  • Bun for JS and Tailwind builds
  • GORM with SQLite for app-local state

Current scope

  • Go owns GET /product/:slug
  • all other routes proxy to the upstream PrestaShop instance
  • product data, customer data, and cart summary are read from the PrestaShop database
  • session state is derived from the live PrestaShop cookie

Requirements

  • Go
  • Bun
  • templ
  • access to the PrestaShop database
  • PrestaShop cookie key, or access to the PrestaShop install root

Configuration

The service now loads .env automatically from the project root at startup.

Important variables:

  • PRESTASHOP_PROXY_TARGET: upstream PrestaShop origin, required
  • DOMAIN_COOKIE: optional domain override used when deriving the hashed PrestaShop-... cookie name
  • PRESTASHOP_COOKIE_NAME: optional explicit cookie-name override. If omitted, the app derives the standard PrestaShop-... name from PrestaShop version and normalized host, and still falls back to prefix matching on reads.
  • PRESTASHOP_COOKIE_KEY: Defuse/PrestaShop cookie key, required unless bootstrap from install root is used
  • DB_USER, DB_PASS, DB_NAME, DB_HOST, DB_PORT: preferred split MariaDB settings
  • DB_PREFIX: PrestaShop table prefix
  • PRESTASHOP_DB_DSN: optional full DSN override
  • PRESTASHOP_PROJECT_ROOT: optional path to an existing PrestaShop install for bootstrap
  • ROUTE_OWNERSHIP_CONFIG: route prefix currently handled by Go

Example MariaDB setup:

PRESTASHOP_PROXY_TARGET=http://localhost
PRESTASHOP_COOKIE_KEY=def00000...
PRESTASHOP_DB_DIALECT=mariadb
DB_USER=presta
DB_PASS=presta
DB_NAME=presta
DB_PREFIX=ps_
DB_HOST=mariadb
DB_PORT=3306

If PRESTASHOP_DB_DSN is set, it takes precedence over the split DB settings.

Install

bun install
templ generate
go mod tidy

Build assets

bun run build

Available Bun scripts:

  • bun run build:js
  • bun run build:css
  • bun run build:manifest
  • bun run build
  • bun run dev

Run

go run ./cmd/proxy

Default listen address is :8080.

Health endpoints

  • GET /healthz
  • GET /readyz

Debug endpoint

  • GET|POST /debug/cookie/decode

Pass a cookie explicitly with value or cookie, for example:

curl "http://localhost:8080/debug/cookie/decode?value=def50200..."

If no parameter is provided, the endpoint returns the cookie already decoded from the incoming request session.

Native cookie logic lives in internal/prestashop/cookie/codec.go.

What it does now:

  • decrypts live PrestaShop cookies in Go
  • parses plaintext key/value fields
  • re-encodes cookies in Go using the same key format

Current limitation:

  • it can round-trip and re-encode cookie content, but it does not yet recompute higher-level PrestaShop semantic fields like checksum for arbitrary mutations

Tests

go test ./...
S
Description
No description provided
Readme 24 MiB
Languages
Go 72.8%
templ 15.5%
JavaScript 9.2%
CSS 2.5%