question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TLS redirect_cleartext_from doesn't preserve path

See original GitHub issue

Describe the bug url path is not preserved with redirect_cleartext_from set

To Reproduce

  1. Follow TLS Termination documentation to create cert and store as kubernetes secret

  2. Deploy ambassador with helm chart 2.2.1 with values:

service:
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind: Module
      name: tls
      config:
        server:
          enabled: True
          secret: ambassador-certs
          redirect_cleartext_from: 8080
  1. Deploy httpbin service to test redirect
---
apiVersion: v1
kind: Service
metadata:
  name: httpbin
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind:  Mapping
      name:  httpbin_mapping
      prefix: /httpbin/
      service: httpbin.org:80
      host_rewrite: httpbin.org
spec:
  ports:
  - name: httpbin
    port: 80
  1. curl the endpoint using http
curl -Li http://hostname/httpbin/
  1. Result: path is not preserved on redirect
HTTP/1.1 301 Moved Permanently
location: https://hostname/
date: Wed, 24 Apr 2019 20:12:19 GMT
server: envoy
content-length: 0

HTTP/2 404 
date: Wed, 24 Apr 2019 20:12:19 GMT
server: envoy

Expected behavior Path should be preserved and redirect to https://hostname/httpbin/

Versions (please complete the following information):

  • Ambassador: [0.60.0] (using Helm chart 2.2.1)
  • Kubernetes environment: [AKS]
  • Version [1.12.7]

Additional context

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
gsagulacommented, May 28, 2019

The problem is that we shouldn’t be setting "path_redirect": "/" if the intention is to preserve the path in the request. There is a logic in Envoy for that:

if (!path_redirect_.empty()) {
    final_path = path_redirect_.c_str();
  } else {
    ASSERT(headers.Path());
    final_path = headers.Path()->value().getStringView();
    if (strip_query_) {
      size_t path_end = final_path.find("?");
      if (path_end != absl::string_view::npos) {
        final_path = final_path.substr(0, path_end);
      }
    }
  }

I will open a PR shortly with the fix. Thanks!

2reactions
gsagulacommented, May 23, 2019

@bpehling @christianhuening Thanks for the info. I will need to debug Envoy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make `sudo` preserve $PATH? - Unix Stack Exchange
You can always do: sudo env "PATH=$PATH" godi_console. As a security measure on Debian, /etc/sudoers has the secure_path option set to a safe...
Read more >
sudo (-E) doesn't preserve path, even when configured ...
In short, setting Defaults !env_reset and using sudo env "PATH=$PATH" works well. Thanks for the comments.
Read more >
How to keep environment variables when using sudo
First you need to export HTTP_PROXY . Second, you need to read man sudo , and look at the -E flag. This works:...
Read more >
Configure TLS with Keystores and Truststores
This topic describes TLS as supported by Mule and how to configure TLS in Mule apps. ... Set path to the location of...
Read more >
How to set path for sudo commands - linux - Super User
This is normally set by the secure_path option in /etc/sudoers . From man sudoers : secure_path Path used for every command run from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found