petitviolet blog

    node.js (3 posts)

    icon
    Written by petitviolet

    Maintenance Mode on Remix w/Google Cloud Armor

    2025-07-15RemixGCPNode.js
    How to implement maintenance mode on Remix using Google Cloud Armor functionality to inject custom headers for requests from non-whitelisted IPs.
    tl;dr Use Google Cloud Armor's header_action to inject a custom header into requests from non-allowlisted IPs, so that your application can check this header in Remix's root loader and display a maintenance page if present. Background Sometimes you need to put your service into maintenance

    Well-formatted logs for Google Cloud Logging

    2025-03-20Node.jsGCP
    Implementing a logger that writes well-formatted informative logs to be compiled to trace logs in Google Cloud Logging
    In writing logs in applications that run on Google Cloud Platform, it requires some configurations to be compiled to trace logs in Cloud Logging. This post describes how to implement it, and also some tips for making logs more useful and informative. Tracked as trace logs in Cloud Logging Node

    Rehype plugin for oEmbed

    2021-12-20Node.js
    Build a rehype plugin for oEmbed which is a format for allowing embedding a url with nice looking.
    I've posted a couple of posts about oEmbed like https://blog.petitviolet.net/post/2020-03-06/oembed-expansion Needless to say, the above card is build via oEmbed. What Rehype Plugin is First of all, according to [the official repository(rehypejs/rehype)](https://github.com/rehypejs/rehype),