SShortSingh.
Back to feed

How a Cloudflare Worker Fix Stopped React SPA from Swallowing API Redirect Routes

0
·1 views

A developer building the Jo4 platform discovered that affiliate tracking links at /go/* were returning the full React single-page application instead of the intended 302 redirect responses. The issue stemmed from Cloudflare's default SPA behavior, which serves index.html for any path not matching a static file, intercepting the requests before they could reach the backend API at jo4-api.jo4.io. As a result, affiliate clicks went unrecorded and partner traffic was lost entirely. The fix involved adding routing logic inside a Cloudflare Worker to intercept /go/* paths at the network edge and proxy them directly to the backend API, bypassing the SPA bundle. Using the redirect: 'manual' option ensured the 302 response was passed through to the browser rather than being resolved by the Worker itself.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Researcher Flags Potential Emotional Safety Gap in GPT-5.6 Sol Reasoning Model

A developer has published an informal analysis suggesting that GPT-5.6 Sol, OpenAI's advanced reasoning model, may carry a conversational safety vulnerability rooted in its strong orientation toward logical precision. The author observed recurring patterns in which the model responded to emotionally sensitive disclosures — such as fear of illness or grief — with technically accurate but psychologically cold replies. The hypothesis is that post-training optimization for task performance and epistemic correctness may have come at the expense of relational sensitivity. The author explicitly acknowledges the findings are not from a controlled study, were not consistently reproducible, and do not constitute a formal safety assessment. The article calls for systematic, independently reproducible investigation into whether logic-first alignment poses risks for vulnerable users in distress.

0
ProgrammingDEV Community ·

BlackBull framework runs HTTP/SSE and MQTT broker in one Python process on edge hardware

Developer Joren Vranckaert has built BlackBull, a pure-Python ASGI framework that consolidates HTTP/1.1, HTTP/2, WebSocket, gRPC, and an MQTT 5 broker into a single process. The project targets edge devices such as Raspberry Pi and Jetson boards, where running multiple daemons — a web server, reverse proxy, and separate MQTT broker — adds provisioning complexity and cross-compilation overhead. BlackBull allows browser clients to receive token-by-token streamed responses via Server-Sent Events over HTTP/2, while IoT sensors and devices communicate concurrently over MQTT on the same box. To prevent blocking the async event loop during CPU-bound model inference, the framework offloads computation to a worker thread and drains tokens through an asyncio queue. The framework is designed to be dependency-free for basic demos, with support for real model backends such as llama-cpp and ONNX through its threading pattern.

0
ProgrammingDEV Community ·

Qarinah tool cuts AI coding agent context tokens by 98% using typed memory packs

A developer built Qarinah, an open-source local memory compiler for AI coding agents like Codex and Claude Code, to address the high cost and inefficiency of replaying entire codebases in long sessions. Instead of sending full project history or relying on generated summaries, Qarinah organizes project knowledge into typed events — decisions, tool outcomes, approvals — linked by relations such as supersedes and supports. When a new task begins, the tool retrieves a small, citation-linked context pack relevant only to that task, keeping source records and context packs separate. In a test across six software tasks, this approach reduced estimated input-context tokens from roughly 442,000 to about 5,700 — a compression ratio of nearly 78:1 — while maintaining retrieval accuracy. Qarinah is available as an npm package under the Apache-2.0 license and ships with plugins for both Codex and Claude Code.

0
ProgrammingDEV Community ·

How AI Evolved From ChatGPT to Autonomous Agents: A Layer-by-Layer Explainer

A student at an English school in Baguio, the Philippines, delivered a talk to classmates explaining how AI technology has progressed from ChatGPT's launch in November 2022 to the era of autonomous AI agents by 2026. The talk outlined key milestones, including the mainstream adoption of RAG for document-grounded answers, OpenAI's introduction of function calling, and Anthropic's Model Context Protocol standardizing tool access. A central theme was that large language models predict text rather than look up facts, making hallucination an inherent structural limitation rather than a fixable bug. Each subsequent development — reasoning models, agents, and reusable agent skills — was framed as a layer built to compensate for the constraints of the layer before it. The explainer was aimed at everyday ChatGPT users who have encountered terms like LLM, RAG, and MCP without a clear understanding of what they actually do.