Jenkins With Nginx Reverse Proxy And Resolver
Based on the error message you receive, it sounds like you're getting HTML pages in place of JavaScript.
Using a proxy_pass
paradigm with a variable, you're telling nginx that it shouldn't mess with the value any further, e.g., regardless of the location
and the URI, all requests to your backend will always be just as the variable says (e.g., with the same URI in your case).
The best option would probably be to use $uri
, $is_args
and $args
, as per NGINX proxy_pass remove path prefix & resolve DNS:
- set $backend "http://jenkins:8080/";- proxy_pass $backend;+ proxy_pass http://jenkins:8080$uri$is_args$args;
Another option, which potentially could be less secure, is to use $uri_request
, which has a slightly different meaning than the plain $uri
in certain limited cases, as per Nginx pass_proxy subdirectory without url decoding:
proxy_pass http://jenkins:8080$request_uri;