<div dir="ltr"><div dir="ltr"><div class="gmail-post-text" style="margin:0px 0px 5px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.3;vertical-align:baseline;box-sizing:inherit;width:637.333px"><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">We have nginx server that redirect service requests by server_name using proxy_pass to upstream:</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">nginx conf:</p><pre style="color:rgb(36,39,41);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">server {
  server_name <a href="http://requestsproxy-rest.us.example.com">requestsproxy-rest.us.example.com</a>;
....
location / {
.....
    proxy_pass <a href="http://Requestsproxy-Rest">http://Requestsproxy-Rest</a>;
</code></pre><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">and the upstream file:</p><pre style="color:rgb(36,39,41);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">upstream Requestsproxy-Rest {
  least_conn;
  server <a href="http://10.1.1.1:29257">10.1.1.1:29257</a> max_fails=4 fail_timeout=1s weight=1;

  server <a href="http://10.1.1.2:21591">10.1.1.2:21591</a> max_fails=4 fail_timeout=1s weight=1;

 }
</code></pre><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">We want to create nginx rewrite rule that will be able to be accessed via "<a href="http://api.example.com/service/{domain}">api.example.com/service/{domain}</a>" and the nginx will forward/redirect the request to different address by the {service} to the nginx.</p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">for example:</p><pre style="color:rgb(36,39,41);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><a href="http://api.example.com/service/{requestsproxy-rest}">api.example.com/service/{requestsproxy-rest}</a> --> {requestsproxy-rest}.<a href="http://us.example.com">us.example.com</a>
</code></pre><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">how do you think we can manage it via nginx configurations?<br><br>I try something like:<br></p><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><font color="#242729" face="Arial, Helvetica Neue, Helvetica, sans-serif"><span style="font-size:15px">location /{(?:[a-zA-Z0-9][a-zA-Z0-9]+$)} {<br></span></font><span style="font-size:15px;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif">      rewrite (.*) $<a href="http://1.example.com">1.example.com</a>;</span></blockquote><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both"><br></p><p style="color:rgb(36,39,41);font-family:inherit;font-size:15px;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">Thanks in advanced.</p></div><div class="gmail-post-taglist gmail-grid gmail-gs4 gmail-gsy gmail-fd-column" style="padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;display:flex;clear:both;color:rgb(36,39,41)"><br class="gmail-Apple-interchange-newline"></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span><div><br></div><div dir="ltr" style="margin-left:0pt"><table style="border:none;border-collapse:collapse"><colgroup><col width="110"><col width="371"></colgroup><tbody><tr style="height:87pt"><td style="border-right:0.75pt solid rgb(69,102,142);vertical-align:top;padding:5pt 8pt 5pt 5pt"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9.5pt;font-family:Arial;vertical-align:baseline;white-space:pre-wrap"><img alt="photo" src="https://lh3.googleusercontent.com/OOck1ddAD2145H_OMyO9MgDmmpRQTqLwTuebui75lXJ0rNdZUAvQDdOewCeZ3ahbu04Cuw8x6ABfQL3OYusb4oD4nWkA4CUh8m0KNV_NJltPEdDR1-Q3sNEJhTTUK8QBU8-CTgkc" width="91" height="93" style="border: none;"></span></p></td><td style="border-left:0.75pt solid rgb(69,102,142);vertical-align:top;padding:5pt 5pt 5pt 8pt"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10.5pt;font-family:Arial;color:rgb(100,100,100);font-weight:700;vertical-align:baseline;white-space:pre-wrap">Eli Fish</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10.5pt;font-family:Arial;color:rgb(100,100,100);vertical-align:baseline;white-space:pre-wrap">Devops Engineer </span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:Arial;color:rgb(11,83,148);vertical-align:baseline;white-space:pre-wrap">m: </span><span style="font-size:10pt;font-family:Arial;color:rgb(141,141,141);vertical-align:baseline;white-space:pre-wrap">+(972) 50-5781700</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:Arial;color:rgb(11,83,148);vertical-align:baseline;white-space:pre-wrap">e: <a href="mailto:efish@yotpo.com" target="_blank">efish@yotpo.com</a></span><span style="font-size:10pt;font-family:Arial;color:rgb(141,141,141);vertical-align:baseline;white-space:pre-wrap">| </span><a href="https://www.yotpo.com/blog/?utm_source=gmail&utm_medium=email&utm_campaign=signature" target="_blank"><span style="font-size:10pt;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap">Check out the Yotpo blog!</span></a></p></td></tr></tbody></table></div></span></div></div></div></div></div></div>