Skip to the page
DataMosaic

Docs · Administration

Behind a reverse proxy

When IIS, nginx or a load balancer sits in front of Mosaic, let a run's progress through as it is sent, or every run looks frozen until it ends.

#What this fixes

You run an investigation and nothing lights up. No step says Looking…, no wire moves, and then every answer appears at once when the run ends. A workflow run by hand does the same: no node pulses while it runs, and then they all finish together. The answers are right. Only the progress is missing.

Opened on the server itself, the same run lights each step as it goes.

#Why it happens

While a run is under way, Mosaic sends its progress over the request that started it: a line when a step starts and a line when it finishes. These screens read it:

  • an investigation, run from its editor, from a row's Investigate, or on a published page
  • a workflow run by hand, or one of its nodes run on its own
  • an agent run by hand

A reverse proxy that collects a response before passing it on holds those lines back, and the browser gets them all together when the run ends. Turn that collecting off for Mosaic's address and the progress arrives as it is sent.

#IIS with Application Request Routing

Application Request Routing (ARR) collects responses by default. To turn that off:

  1. Open IIS Manager on the server in front of Mosaic.
  2. Select the server's own node: the machine name, above Sites.
  3. Open Application Request Routing Cache, then press Server Proxy Settings… in the Actions pane on the right.
  4. Under Buffer Setting, set Response buffer threshold (KB) to 0.
  5. Press Apply.

Run the investigation again: each step lights while it runs. Mosaic needs no restart.

#nginx

Nothing to do. Mosaic marks its progress with the header X-Accel-Buffering: no, and nginx honours it unless proxy_ignore_headers tells it not to. If it does, add proxy_buffering off; to the location that forwards to Mosaic.

#Anything else

Look in its settings for response buffering and turn it off for Mosaic's address. If the progress still arrives in one piece, look for another layer between the browser and Mosaic that collects responses: a second proxy, a load balancer, response compression, or a firewall that inspects web traffic.

#Finding what holds it

  • Ask Mosaic directly. On the server Mosaic runs on, open http://localhost:4317 (or the port MOSAIC_PORT names) and run the same investigation. If each step lights there, Mosaic is fine and something between the browser and the server holds the progress.
  • Read who answered. In your browser's developer tools, open the Network tab and select any request to Mosaic. A response header such as X-Powered-By: ARR/3.0 names the proxy in front.

#What else a proxy has to pass on

  • The address people type. Mosaic refuses a sign-in, a save or a run with Cross-site request refused. when the address in the browser does not match the name the request reached Mosaic under. A proxy that forwards under another name should send that address in X-Forwarded-Host. If it cannot, list the address in MOSAIC_TRUSTED_ORIGINS, for example https://mosaic.example.com. Separate several with commas.
  • HTTPS. When the proxy ends HTTPS and forwards plain HTTP, have it send X-Forwarded-Proto: https, so Mosaic marks the sign-in cookie Secure.
  • The public address. Set MOSAIC_PUBLIC_URL to the address people use, so published pages and webhooks point there rather than at the server behind the proxy. See Settings worth knowing.