Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambassador and 302 redirects #1064

Closed
marcin-kasinski opened this issue Dec 21, 2018 · 2 comments
Closed

Ambassador and 302 redirects #1064

marcin-kasinski opened this issue Dec 21, 2018 · 2 comments

Comments

@marcin-kasinski
Copy link

I have zipkin service :

---
apiVersion: v1
kind: Service
metadata:
  name: springbootzipkin
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind: TracingService
      name: tracing
      service: springbootzipkin:7777
      driver: zipkin
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  springbootzipkin_mapping
      prefix: /springbootzipkin
      timeout_ms: 10000
      service: springbootzipkin.apps:7777
      ---
spec:
  type: NodePort
...

I test it with:

wget http://${GATEWAY_URL}/springbootzipkin
--2018-12-21 12:56:30--  http://10.109.22.156/springbootzipkin
Connecting to 10.109.22.156:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: ./zipkin/ [following]
--2018-12-21 12:56:31--  http://10.109.22.156/zipkin/
Reusing existing connection to 10.109.22.156:80.
HTTP request sent, awaiting response... 404 Not Found
2018-12-21 12:56:31 ERROR 404: Not Found.

In ambassador log I can see:

ACCESS [2018-12-21T12:56:31.008Z] "GET /springbootzipkin HTTP/1.1" 302 - 0 0 9 8 "10.44.0.0" "Wget/1.19.4 (linux-gnu)" "06608c8b-6db0-990c-8d85-57ba5845ce1b" "10.109.22.156" "10.111.73.173:7777"
ACCESS [2018-12-21T12:56:31.023Z] "GET /zipkin/ HTTP/1.1" 404 NR 0 0 0 - "10.44.0.0" "Wget/1.19.4 (linux-gnu)" "3269d38f-b8ed-954d-af55-0d6772c3e3af" "10.109.22.156" "-"


I get 404 becasue of zipkin reply with 302 /zipkin redirect.

My question is:

How can I solve this problem ?

It would be great on ambassador to inject this reply based on my mapping and instead of /zikpin reply with /springbootzipkin/zikpin

@kflynn
Copy link
Member

kflynn commented Jan 4, 2019

Envoy, on which Ambassador is built, doesn't have a way to rewrite received HTML or redirects. Many web apps are now offering a way to tell the application the path under which it's running (e.g., tell your Zipkin installation that its routing prefix is /springbootzipkin/zipkin/ instead of just /zipkin/). This is a much more robust solution than trying to do rewriting in the proxy.

I'm going to go ahead and close this issue. Our Slack channel is also available if you have further questions.

@lily524
Copy link

lily524 commented Feb 4, 2020

@marcin-kasinski Do you find the solution for redirect issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants