Nomad UI under a reverse proxy subdirectory
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
Nomad v0.10.4 (f750636ca68e17dcd2445c1ab9c5a34f9ac69345)
### Operating system and Environment details
Windows 10, nginx/1.17.1
### Issue
I am trying to get Nomad UI working under a reverse Proxy subdirectory. When it comes to reverse proxy, I followed the steps from this nice article provided by you guys: https://learn.hashicorp.com/nomad/operating-nomad/nginx-reverse-proxy
When I host it under the / location it is no problem. Everything works exactly as decribed on the article.
The trouble starts when I try to host it on another location, '/nomad/' for example. WHat happens on that case is that it seems that the UI from nomad tries to get the resources always from http://localhost/ui, when the expected would be http://localhost/nomad/ui
Would you kindly assist me on the steps I should do to get it working under a reverse proxy subdirectory?
### Reproduction steps
My NGINX Config is similar to:
```
location /Nomad/ {
if ($request_uri ~* "/Nomad/(.*)") {
proxy_pass http://127.0.0.1:4646/$1;
}
proxy_pass http://127.0.0.1:4646;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Path /Nomad;
}
```
### Redirects(in Chrome))
When I get to https://localhost/Nomad, the following events happens:
1.
Request URL: https://localhost/Nomad
Request Method: GET
Status Code: 301 Moved Permanently
Remote Address: [::1]:443
Referrer Policy: no-referrer-when-downgrade
2.
Request URL: https://localhost/Nomad/
Request Method: GET
Status Code: 307 Temporary Redirect
Remote Address: [::1]:443
Referrer Policy: no-referrer-when-downgrade
3.
Request URL: https://localhost/ui/
Request Method: GET
Status Code: 404 Not Found
Remote Address: [::1]:443
Referrer Policy: no-referrer-when-downgrade
As you probaly noticed, after the 307, it tries to reach the /ui, which does not exists and end up with a 404 error...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing Nomad's UI redirect and resource URL handling for requests served through the /Nomad/ subdirectory, using the reported 301, 307, and /ui requests as the reproduction. Compare that behavior with the supplied NGINX configuration and X-Forwarded-Path header; done means the UI loads its resources under the configured subdirectory without redirecting to the root /ui path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, nginx
- Domain
- devops, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100