Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reverse proxy nginx configuration example #594

Open
jibwf opened this issue Nov 29, 2024 · 4 comments
Open

Add reverse proxy nginx configuration example #594

jibwf opened this issue Nov 29, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jibwf
Copy link

jibwf commented Nov 29, 2024

Note: if you have a question or want discussion please post in the discussions area.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
I am hitting issue when setup reverse proxy on nginx. I think it may related with Authorization header.

Describe the solution you'd like

Here is my exmaple fo reference, but I do not know if it is best.

location / {
  proxy_pass http://192.168.1.2:9898;
  proxy_set_header Host $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-Host $http_host;
  proxy_set_header X-Forwarded-Port $server_port;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_pass_header Authorization;                                   >>>
  proxy_set_header Authorization $http_authorization;   >>>
}

}

Additional context
Add any other context or screenshots about the feature request here.

@jibwf jibwf added the enhancement New feature or request label Nov 29, 2024
@garethgeorge
Copy link
Owner

Hi -- first, thanks for posting the example. Can you elaborate on the issues you were hitting? Are they resolved in that config or are you still working through a problem?

@jibwf
Copy link
Author

jibwf commented Nov 30, 2024

Hi -- first, thanks for posting the example. Can you elaborate on the issues you were hitting? Are they resolved in that config or are you still working through a problem?

After enabled reverse proxy by nginx, I was not able to login the backrest page. It routed to nginx admin page automaticlly.

Now, after add both "proxy_pass_header Authorization" and "proxy_set_header Authorization", I can login to backrest successfully.

But even add authorization header, I still see API reconnect warning sometimes.

@colserra1
Copy link

colserra1 commented Dec 1, 2024

I am running into a similar issue: I am also running backrest behind nginx, and while I never had trouble reaching the login page, I do get the API Errors every few minutes. I already tried increasing the timeout interval without success. My nginx conf:

`server {
listen 54.39.243.77:443 ssl;
server_name X
server_tokens off;
ssl_certificate X
ssl_certificate_key X;

client_max_body_size 20M;
location / {
    proxy_pass http://127.0.0.1:9898;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_read_timeout 1d;
    proxy_send_timeout 1d;
    keepalive_timeout 1d;
    proxy_intercept_errors on;
}

}`

This also means that the progress indicators for operations are not working since the session does not get kept alive long enough.

@garethgeorge
Copy link
Owner

You might also try turning off proxy_buffering off; which should help with streaming compatibility. Generally, Backrest makes heavy use of HTTP streams. Keepalive timeout is also known to be important -- backrest will send an empty packet every 1 minute to try to help with this, but the timeout parameter must be at least a few minutes.

I'd encourage using a more modern reverse proxy e.g. Caddy for the best experience but I do believe some users have had success with nginx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants