4

I can't wrap my head around how this is not the same:

  1. does not work
    set $upstream_app myapp;
    set $upstream_port 1234;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port/;
  1. does work

    proxy_pass http://myapp:1234/;

I suppose it must have to do with the trailing slash. Even when I add the trailing slash to the var, it does not work. In fact, if I only replace one part of the uri it already breaks.

Anybody got an idea? Thanks in advance!

Edit: I have a resolver in place. resolver 127.0.0.11 valid=30s;

Sutider
  • 41
  • 2
  • 1
    `proxy_pass` with and without variables in the value, behave differently. See [this document](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass). – Richard Smith Dec 09 '20 at 15:46
  • @RichardSmith I can't seem to find how the `proxy_pass` with variables behave differently. Can you elaborate, please? https://stackoverflow.com/questions/46230270/nginx-using-variable-in-proxy-pass-breaks-routing This didnt help either – Sutider Dec 12 '20 at 17:43
  • 2
    From the documentation: "When variables are used in proxy_pass ..., if URI is specified in the directive, it is passed to the server as is, replacing the original request URI." – Richard Smith Dec 12 '20 at 17:52

0 Answers0