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

Problem with path strip and prepend #948

Open
lastcmaster opened this issue Aug 14, 2024 · 2 comments
Open

Problem with path strip and prepend #948

lastcmaster opened this issue Aug 14, 2024 · 2 comments
Assignees

Comments

@lastcmaster
Copy link

We can not get fabio to strip the only element in the URL, se example:
`
Target:
http://k8swork01.hi5.ismobile.com:8083/optimizer/optservlet

=================
Problem setup:

Consul tag:
urlprefix-optimizer.cloud.ismobile.com/sweden strip=/sweden prepend=/optimizer/optservlet

Extenal call:
https://optimizer.cloud.ismobile.com/sweden?sync&timeout=20

Expected:
POST /optimizer/optservlet?sync&timeout=20 HTTP/1.1
Host: optimizer.cloud.ismobile.com

Actual:
POST /optimizer/optservlet/sweden?sync&timeout=20 HTTP/1.1
Host: optimizer.cloud.ismobile.com

=================
Working setup:

Consul tag:
urlprefix-optimizer.cloud.ismobile.com/sweden strip=/sweden

Extenal call:
https://optimizer.cloud.ismobile.com/sweden/optimizer/optservlet?sync&timeout=20

Expected:
POST /optimizer/optservlet?sync&timeout=20 HTTP/1.1
Host: optimizer.cloud.ismobile.com

Actual:
POST /optimizer/optservlet?sync&timeout=20 HTTP/1.1
Host: optimizer.cloud.ismobile.com
`

@tristanmorgan
Copy link
Member

One thing to look at in the fabio logs is a line like:

+ route add optimizer optimizer.cloud.ismobile.com/sweden http://optimizer.cloud.ismobile.com/ opts "strip=/sweden prepend=/optimizer/optservlet"

this will test if the urlprefix- is getting parsed properly.

You can also test the functionality manually by adding lines in the Overrides of the UI.

@tristanmorgan tristanmorgan self-assigned this Dec 4, 2024
@tristanmorgan tristanmorgan added bug and removed bug labels Dec 4, 2024
@tristanmorgan
Copy link
Member

I've tried to reproduce the error but not succeeded.

another way to check the routing table is via the API.

$ curl -s http://fabio.service.consul:9998/api/routes | jq 'map(select(.service == "fake"))'
[
  {
    "cmd": "route add",
    "dst": "http://10.0.0.23:20869/",
    "host": "fake.service.consul",
    "opts": "strip=/sweden prepend=/optimizer/optservlet",
    "path": "/sweden",
    "pct99": 0,
    "rate1": 0,
    "service": "fake",
    "src": "fake.service.consul/sweden",
    "weight": 1
  }
]

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

No branches or pull requests

2 participants