Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
nginx reverse proxy location

I would like to have nginx set as a reverse proxy following these rules:

http://www.example.com/home/{x}/{y}//index.html?zvalue={z}&a=1&b=2&c=3 etc...

proxied to

http://www.example2.com/home/{x}/{y}/{z}/index.html?a=1&b=2&c=3 etc...

So basically the query string value of {z} is set as part of the path. All other query params such as a,b,c,d etc need to be forwarded as shown in the example.

What are the configuration I need to put in nginx?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Manipulating the query string is best done using a map with named captures. See this document for details.

For example:

map $request_uri $proxy {
    default 0;
    ~*^(?<prefix>/home/.*)/index.html\?zvalue=(?<zvalue>[^&]+)&(?<suffix>.*)$ $prefix/$zvalue/index.html?$suffix;
}

Obviously the regular expression needs to match your exact requirements, and the above was just a proof of concept.

You can use the variable with a proxy_pass statement, within an if block, within an existing location. See this document for details.

For example:

location / {
    proxy_pass http://example.com;
    if ($proxy) { proxy_pass http://example.com$proxy; }
}

Any request which is not subject to the map will be passed transparently by the first proxy_pass statement.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda