-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Feature request]get host in route rule #189
Comments
Not sure I understand the request. I guess this is about the static file provider, and if this is the case, you can already define the host, not as part of the rule itself you provided, but rather as a higher-level "key". default:
- {route: "^/api/svc1/(.*)", dest: "http:https://127.0.0.1:8080/blah1/$1"}
- {route: "/api/svc3/xyz", dest: "http:https://127.0.0.3:8080/blah3/xyz", "ping": "http:https://127.0.0.3:8080/ping"}
- {route: "/web/", dest: "/var/web", "assets": yes, "keep-host": yes, "remote": "192.168.1.0/24, 124.0.0.1"}
- {route: "/web2/", dest: "/var/web2", "spa": yes, "keep-host": no}
srv.example.com:
- {route: "^/api/svc2/(.*)", dest: "http:https://127.0.0.2:8080/blah2/$1/abc"} This config defines two sets of rules - one for srv.example.com and another (default) as a catch-all-others |
Yes, in my case that is for serving static files. But as mentioned in the example, the dest was an s3 server for multi-domains.
in the case of wildcard sub-domain, i don't know the host exactly. more clearly explain: there are many sub-folders named by domain name for multi-sites in some bucket of s3. Request should be proxied to different sub-folders. *.cdn.example.com
- { route: "^/statics/(.*)", dest: "http:https://s3.my.domain/public/${host}/blah1/$1" } |
It very useful for both static and dynamic upstreams in wildcard domains case. |
Thank you for the clarification, it makes sense. I initially missed the key part with |
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change.
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change.
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change. make additional test without host substitution add test with ${host} substitution
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change. make additional test without host substitution add test with ${host} substitution
The change is on the master branch. It supports both Give it a try and let me know if it works as described. |
got "Server error" config "*.s3.nas.home":
- {route: "^/(.*)", dest: "http:https://s3.nas.home:9000/www/$host/$1"} logs:
|
I doubt it even worked with a wildcard in the server (hostname), and it is likely unrelated to the changes. Probably making it a regular expression will do the trick, i.e., As I have some time, I will add patterns too, but for now they are not supported. |
as ur words, it works as changing host to thanks for all ur works. |
It seems reproxy doesn't support get host in route rule.
For example:
- { route: "^/api/svc1/(.*)", dest: "http:https://s3.my.domain/public/${host}/blah1/$1" }
The text was updated successfully, but these errors were encountered: