-
Notifications
You must be signed in to change notification settings - Fork 327
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
Rewrite URI into request arguments #992
Comments
Hi, You might write the configuration like:
Unit now doesn't support custom variables from regexp with the |
The previous request arguments are appended after a Lines 91 to 93 in 822303e
Nginx handles this by appending a |
Sorry, I used the wrong configuration. https://unit.nginx.org/configuration/#uri-rewrite
And we have an idea of how to change the query, but it's not clear yet.
Anyway, we need to support custom variables with the captured regexp names. |
The syntax looks OK, except that I don't think You will need to consider what to do with the previous request arguments (i.e. existing arguments before the rewrite). Nginx has a "putting a question mark at the end of a replacement string" way of configuring it, but it's a bit too obscure. |
Actually, in nginx, you also can set
We intend to make the usage as concise as possible, and nginx's way is more powerful with more rules. |
@hongzhidao as we have worked on #916 we made use of {
"action": {
"rewrite": "`${uri.replace(/^(\\/[^\\/]+)?(\\/.*\\.php)/, '$2')}`",
"share": "/sites/$host$uri",
"fallback": {
"pass": "applications/$host/index"
}
}
} In this example we are using matching blocks of the regext to build a new URI. Coulnd't this help in this case? |
It looks like the case is related to how to change/rewrite the request query/arguments. And the |
Okay then scratch that. Let's think about enhancing the rewrite support and what release is a good fit for that. |
https://nginx.org/en/docs/http/ngx_http_rewrite_module.html
I would say the rule is complicated, It has advantages and disadvantages in terms of use and implementation cost. |
I'm trying to configure Unit for Phabricator, which requires rewriting the URI into a request argument
__path__
and keeping the previous request arguments.In Nginx, this can be implemented with
rewrite ^/(.*)$ /index.php?__path__=/$1 last;
, but Unit does not support it.See also #732.
The text was updated successfully, but these errors were encountered: