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

Base URL flag #237

Open
njenkins84 opened this issue Jun 7, 2023 · 2 comments
Open

Base URL flag #237

njenkins84 opened this issue Jun 7, 2023 · 2 comments

Comments

@njenkins84
Copy link

Output of rest-server --version

rest-server version rest-server 0.12.0 compiled with go1.20.3 on linux/amd64

What should rest-server do differently?

Would it be possible to add a base url flag?
This way the base part of a request can be ignored, as it was used to route traffic to the server, not the user trying to make a request on the server.

What are you trying to do? What is your use case?

The rest-server is behind an Nginx proxied port. As configured the proxied port does not perform request matching on the base URL. Thus, the rest-server interprets incoming request from the user incorrectly, i.e. it see the request come in as "/base_path/user/..." rather then simply "/user/...".

Did rest-server help you today? Did it make you happy in any way?

The rest-server works great and am very happy with how it is performing!

@wojas
Copy link
Contributor

wojas commented Jun 7, 2023

You can rewrite the path in nginx with something like:

rewrite ^/base_path/(.*)$ /$1 break;

@njenkins84
Copy link
Author

njenkins84 commented Jun 7, 2023

The Nginx config is auto-generated such that the matching is not performed. I have full control over the Nginx config on my local development machine and can configure the URL matching easily

location /base_path/ {
    proxy_pass http://127.0.0.1:1234/;
}

The issue arose when configuring host for deployment which omits the trailing slashes, thus no URL matching occurs.

An alternative I'm also looking into would be to use rclone rather that rest-server to host the restic server as it appears to provide for configuring a base-url.

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

No branches or pull requests

2 participants