Dual-Endpoint Web Application (Dashboard + API)

Sample

A single web application with two unique API endpoints, with appropriate tokens to secure them.

98208b64 messaging

Overview

See the companion code in Github. This can be run with docker-compose up to demonstrate.

In this example, we have an HTML web dashboard (running on localhost:5000), and an API (running pn localhost:5001). We use the Web Application Firewall rewrite to remap the API to a prefix (so it will become conceptually localhost:5000/api). This allows it to be represented as a single-sign-on session, on a single external URL.

In this example, we first create an application. On the 3rd step, “My Application Is An API”… if your API correctly uses CORS, you can leave this as-is. Else consider setting it, or example the ‘Define’ step later for more configuration.

When you get to step 7 (Configure Upstream Services), enter 1 for each endpoint. The main (HTML) one is ‘application’, the others are path_prefix. Substitute the real hostname if you need (you may need additional remapping later if your application is hard-coded).

Once you have completed the New Application Stepper, navigate to the ‘Define’ screen to refine the setup. On the ‘Proxy’ Tab, enable ‘Rewrite Common Media Types’.

Add permission to your user, and the page should work at https://<name><domain>/

9acd6364 p1
81cf0af1 p2
a8308de4 p3
436f2239 p5
c951daae p6
f43ba286 p7
0756aeb8 p8
b1d1d376 p10
88c28bec p11
0441a33e p12
79e7662c p13