nginx-adapter
nginx-adapter copied to clipboard
support nginx-adapter rewrite regexp
I'm trying to add some functions to the nginx-adapter.I found that the rewrite of nginx-adapter seems not to support regular expressions In nginx,config like :
location ^~ /api {
rewrite ^/api(/.*)$ $1 break;
proxy_pass http://127.0.0.1:8000;
}
It should be write :
rewriteHandler := Rewrite{
PathRegexp: []*regexReplacer{
{
Find: "^/api(/.*)$",
Replace: "$1",
},
},
}
But regexReplacer can not be use in nginx-adapter. What should I do?
Thank you for working on enhancing the adapter! Supporting replacements was tricky, and I have unfinished work that was never pushed. I believe you can encode them as JSON, then unmarshal them into the Rewrite struct. Does that work?
I can try to complete part of the work of nginx-adapter.
That would be cool! Thank you!