-
Notifications
You must be signed in to change notification settings - Fork 617
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
Add raw tags #455
Comments
I think you would want to use a different prefix for the raw tags. What is the real impetus for adding this capability? Are you intending for there to be new extensions to the route syntax that can't be expressed using the "short" |
I could see this being useful as fabio gradually moves to supplant the major reasons people give for deploying another more traditional reverse proxy like nginx or haproxy before fabio. These primarily seem to revolve around header mangling which could be tricky to express with the Take the following example for header manipulation with pseudo variables:
Versus something maybe more legible and dynamic...
Maybe not the best example? |
@ctlajoie My main motivation is that there are two ways of expressing the same thing and there is a slight difference in syntax. Also, Maybe it is just me wanting to clean up but in the process I make things more complex. What do you think? |
You can think about the difference between the two as being declarative vs imperative. If I add a tag Allowing route commands like that in tags also implies other things are also possible to do with the tag, such as IMO it makes more sense to use a declarative syntax for service tags. |
I am probably biased because I have never needed to manually add routes using the |
So we've starting using I guess I'm back to my original request of just wanting a catch-all https-redirector, and I'd prefer putting |
Hey @magiconair had a chance to think any more about a global https redirector? |
@holtwilkins you can already do the "catch all" HTTP->HTTPS redirect. We're doing that today with the following route:
|
To get exactly what you are wanting we could probably add another pseudo-variable for |
Yup @leprechau that would be great. |
So, after actually looking at the code I think we could do this without introducing another variable. I think we could just add a single code block to the end fo the
Does that look reasonable? Should we add the pseudo-variable just to make it more explicit? |
@holtwilkins would you care to open a new issue around this specifically? |
Hey @leprechau I'm happy too, but not sure how to word it. It seems like the old PR at #451 was meant to do something similar to this but was seemingly forgotten about? Should I open an issue calling out host-less redirects? |
Fabio currently uses specially crafted Consul tags (
urlprefix-host/path opt opt ...
) to generate route commands which build the fabio routing table. There is a certain impedance mismatch between the syntax of theurlprefix-
tags and theroute add
commands they generate, e.g.It would be useful if the
urlprefix-
tags are just a convenient shorthand notation for common more complex route commands but users could choose to express the same thing as a route command as well. This would limit the syntax of theurlprefix-
commands to what is necessary for the most common uses cases.For this to work, the code would need to distinguish between two types of tags:
short
andraw
raw
tags are added verbatim (without the tag prefix) to the routing table whereas theshort
tags provide a special shorthand notation syntax which needs to be parsed and transformed.Additionally, the
raw
tags need pseudo-variables to inject the service name and service address which are currently generated from theurlprefix-
tags to be fully equivalent.urlprefix-/
could then also be written asfabio route add $service / http://$addr/
assuming thatfabio
is the raw prefix tag.The open questions are whether there should be a different prefix for the raw tags or whether this should be rolled into the
urlprefix-
syntax. Since theurlprefix-
syntax is already used for defining TCP services I think we shouldn't overload it even further.I'd like to gather some ideas on the syntax of a
fabio
tag for defining routes and allowing raw route commands and then we start with the route commands.Note
There is an open issue/pr somewhere which has these ideas but I can't find it right now. Will update when I do.
Note2
Part of the discussion is in #87 (comment)
The text was updated successfully, but these errors were encountered: