solo-io / workshops

Apache License 2.0
127 stars 72 forks source link

[Gloo Edge - Instruqt - Lab 3] Data transformation example never shows custom HTML from RouteTable #91

Closed jameshbarton closed 3 years ago

jameshbarton commented 3 years ago

The Lab 3 data transformation example never shows custom HTML from RouteTable below. The rate limit rule is apparently never triggered. It just keeps showing the "successful" result.

# cat files/rt-transformation.yaml

apiVersion: gateway.solo.io/v1
kind: RouteTable
metadata:
  name: httpbin-routetable
  namespace: team1
  labels:
    application-owner: team1
spec:
  routes:
# -------- Rate limit at route level requires to give a name -------
    - name: "not-secured"
# ------------------------------------------------------------------
      matchers:
        - prefix: /not-secured
      options:
        prefixRewrite: '/'
# -------- Rate limit as you saw before ------------
        ratelimitBasic:
          anonymousLimits:
            requestsPerUnit: 5
            unit: MINUTE
# --------------------------------------------------
# ---------------- Transformation ------------------
        transformations:
          responseTransformation:
            transformationTemplate:
              parseBodyBehavior: DontParse
              body:
                text: '{% if header(":status") == "429" %}<html><body style="background-color:powderblue;"><h1>Too many Requests!</h1><p>Try again after 1 minute</p></body></html>{% else %}{{ body() }}{% endif %}'
#---------------------------------------------------
      routeAction:
          single:
            upstream:
              name: team1-httpbin-8000
              namespace: gloo-system
jmunozro commented 3 years ago

maybe duplicated https://github.com/solo-io/procgen/issues/38 @kameshsampath