emptygif
ಭಾಷೆ: ಕನ್ನಡ

ಎಲ್ಲಾ ಭಾಷೆಗಳು ಮತ್ತು ಫ್ರೇಮ್‌ವರ್ಕ್‌ಗಳು

Envoy (direct_response) YAML

/pixel.gif ಗೆ ಬರುವ ವಿನಂತಿಗಳಿಗೆ ಖಾಲಿ GIF ನೊಂದಿಗೆ ಉತ್ತರಿಸುವ, Envoy (direct_response) ಗಾಗಿ ಒಂದು YAML ಸ್ನಿಪೆಟ್; GIF ಅನ್ನು ಆರಂಭದಲ್ಲಿ ಒಮ್ಮೆ ಮಾತ್ರ ಡಿಕೋಡ್ ಮಾಡಲಾಗುತ್ತದೆ.

Envoy (direct_response) YAML

ಫೈಲ್
envoy.yaml
ರನ್
envoy -c envoy.yaml
static_resources:
  listeners:
    - name: http
      address:
        socket_address: { address: 0.0.0.0, port_value: 8080 }
      filter_chains:
        - filters:
            - name: envoy.filters.network.http_connection_manager
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
                stat_prefix: ingress
                http_filters:
                  - name: envoy.filters.http.router
                    typed_config:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
                route_config:
                  virtual_hosts:
                    - name: default
                      domains: ["*"]
                      routes:
                        - match: { path: "/pixel.gif" }
                          direct_response:
                            status: 200
                            # bytes fields are base64 in YAML/JSON
                            body: { inline_bytes: "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" }
                          response_headers_to_add:
                            - header: { key: content-type, value: image/gif }
                              append_action: OVERWRITE_IF_EXISTS_OR_ADD
                            - header: { key: cache-control, value: no-store }
                              append_action: OVERWRITE_IF_EXISTS_OR_ADD

ನಾವು ಈ ಸ್ನಿಪೆಟ್ ಅನ್ನು ರನ್ ಮಾಡಿ, ಅದು ಹಿಂತಿರುಗಿಸಿದ ಬೈಟ್‌ಗಳನ್ನು ಹೋಲಿಸಿದ್ದೇವೆ.

ಪರಿಶೀಲಿಸಿ

curl -sI http://localhost:8080/pixel.gif

ಅಧಿಕೃತ ಸೈಟ್: Envoy (direct_response)