Unable to reverse proxy as a subpath using nginx on fresh install
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 796
- PR merge metrics
- No merged PRs in 30d
Description
GRR version - 3.2.1-1 on Ubuntu 16.04
From a fresh install I am unable to get GRR to work as a subpath on an nginx reverse proxy; however, if using the default location of / it works. While being a subpath everything has an absolute path instead of relative and so.. it doesn't work.
I've went through and modified the following files by hand - changing absolute to relative, and it works this way. Is this the only way to have this work or is there a simpler method that can be done in in the urls / wsgi python?
```
Files modified:
/usr/share/grr-server/lib/python2.7/site-packages/grr/gui --- starting here
templates
base.html - replace all /static with static, replace all /help with help
static
angular-components/* - Every file from here and further in - Replacing /static with static like above
less
bootstrap_grr.less - replace /static with static
third-party
splitter.css - urls for images must be ../images/paneXXXXX
dist
grr-ui.bundle.js - "/static , "/api , "/clients , "/config , "/users , "/flows , "/hunts , "/artifacts , "/cron-jobs - This took a lot more work as some of the urls are sensitive and doing a mass sed on "/NAME breaks some of the api calls / url mergers.
grr-ui.bundle.css - replace /static with static
third-party.bundle.css - urls for images must be ../images/paneXXXXX
```
I believe this is all of the files.. I pretty much sed'd these, started GRR back up and kept up F12 - Dev Tools to look for breaks. There is probably a few others but this was an initial trial.
```
Nginx conf:
location /grr/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://GRR-IP:8000/;
}
NOTE: THIS Below works without modifying any GRR files, but for a subpath, the above has to be done
EDIT: These two locations are not being ran together. I started with this one, then after modifications went to the above one.
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://GRR-IP:8000/;
}
```
Before I decided to keep these changes, I figured I would ask here if there was a better way / will this break any functionality. With the changes mentioned above, I can call it at / on it's IP or as /ANYTHING/ on the nginx reverse proxy.
Contributor guide
Assessment
This issue has not been assessed yet.