Adjusting Production React Apps: Life made easy by using Requestly

Sebastian Kurfürst06.07.2017

As you might know, I am one of the developers of the new Neos React UI (btw, which recently has been released as 1.0.0 beta 3). At the beginning, I was developing the UI solely using the Neos Demo Site; as there were so many things missing and not yet implemented that the focus was really on getting the architecture, features, state structure and performance right.

By now, however, most basic features are in place; and I feel that I actually need to use the User Interface to feel the glitches and issues. Until now, this led to quite long cycle, involving:

  • Writing some content on a live system
  • Seeing some glitch or issue
  • Trying to reproduce the issue in the local dev machine
  • Fix the issue
  • Push the issue to GitHub
  • Merge the fix when everything passed through travis
  • Update the live system
  • Profit from the bugfix

As you can see, this is quite a tedious and long cycle to go. At some point I thought: Couldn't there be a way to use my local development JavaScript code on the live system? I don't often need to change server-side code; 95% of what I do currently involves adjusting the client side.

Actually, it would be quite easy to do: I'd just need to run a local development build of the React UI, and replace some JS and CSS URLs from the remote system with URLs from my local machine. Turns out this already exists!

Enter Requestly.

Requestly is a browser extension which allows to manipulate HTTP requests; pretty much by applying "search and replace" on URLs.

So, to use it, I did the following:

  1. Install the extension.
  2. Go to www.requestly.in/rules, which is the rule editor for your local browser (no clue why it is on a remote site though...)
  3. Create a new rule of type Replace Host.
  4. Configure Requestly like in the screenshot below.
  5. Profit!
KI generiert: Das Bild zeigt eine Benutzeroberfläche für das Erstellen von URL-Weiterleitungsregeln. Die Regel ersetzt URLs von "sandstorm.de" mit lokalen URLs auf "127.0.0.1".

Profit!

Turns out that this is an extremely cool and flexible way to do smaller and bigger changes to the Neos React UI in a real-world environment; it even works with Live Reload (if you allow mixed-origin content in Chrome when serving your website via HTTPS).

While you try this out, don't forget to push your adjustments to the Neos React UI as Pull Requests to the project.

If you wanna give feedback, you can reach me most easily on Twitter at my handle @skurfuerst. I'd love to hear from you!

Dein Besuch auf unserer Website produziert laut der Messung auf websitecarbon.com nur 0,28 g CO₂.