Report this

What is the reason for this report?

Is this the proper way to use an NGINX rewrite to strip a subdirectory off a request?

Posted on February 16, 2021

I’m using a location block to respond to requests at http://domain.com/v3/ but I want requests for resources like /v3/accounts/ to be passed to the application as simply /accounts/.

I’ve configured the following rewrite rule in the location block, but I was reading about taxing rewrites in the NGINX docs and I was hoping somebody could tell me if I’ve written the wrong type of regex for this rewrite:

 rewrite ^/v3/(.*)$ /$1 break;

Thank you!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.