Yacht
Yacht copied to clipboard
[Feature Request] Add a url prefix option
Is your feature request related to a problem? Please describe. just a option to input a url base path to use together with other services in a reverse proxy like nginx o traefik. If I served on /yacht with a reverse proxy, yacht would fail because the resources would be requested from /. It is a problem that the portainer also has.
Describe the solution you'd like able to put a base path when starts yacht and web must be available on /foo instead of /
Describe alternatives you've considered basically none for yacht
Additional context none
I believe this should already be possible. I tested it with Traefik a few months ago and remember it working. If it's not working, let me know and I'll take a look into the configuration and see about fixing it. In the meantime a subdomain would be recommended.
While all assets for Yacht load and (presumably) work fine, all API calls are still sent to example.tld/api, as opposed to example.tld/yacht/api.
The issue has been tested and determined to be a problem on the Nginx side; no issue with Yacht.
https://serverfault.com/questions/811563/nginx-rewrite-to-proxy-pass-server-path You may need a second rewrite for API stuff as well. Feel free to experiment and let me know.
Here's a working config for nginx reverse proxy for yacht:
Yacht will be served from https://fqdn:5432/yacht
/etc/nginx/nginx.conf
server {
listen 5432 ssl;
server_name fqdn;
ssl_certificate /etc/nginx/certs/koti-web.crt;
ssl_certificate_key /etc/nginx/certs/koti-web.key;
error_page 497 https://$host:5432$request_uri;
include /etc/nginx/conf.d/yacht.conf;
}
/etc/nginx/conf.d/yacht.conf
location /yacht {
return 302 /yacht/;
}
location /yacht/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_http_version 1.1;
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 https;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:8000;
proxy_redirect http:// https://;
proxy_buffering off;
proxy_request_buffering off;
proxy_set_header Origin '';
client_max_body_size 0;
rewrite ^/css(/.*)$ /yacht$1 break;
rewrite ^/js(/.*)$ /yacht$1 break;
rewrite ^/img(/.*)$ /yacht$1 break;
rewrite ^/api(/.*)$ /yacht$1 break;
}
location /api {
proxy_pass http://127.0.0.1:8000/api;
}
Reposting the comment above in case the original user comes back and tries to delete it as we had issues with them being toxic in our discord and here (hence the deleted comment above).
Here's a working config for nginx reverse proxy for yacht:
Yacht will be served from https://fqdn:5432/yacht
/etc/nginx/nginx.conf
server {
listen 5432 ssl;
server_name fqdn;
ssl_certificate /etc/nginx/certs/koti-web.crt;
ssl_certificate_key /etc/nginx/certs/koti-web.key;
error_page 497 https://$host:5432$request_uri;
include /etc/nginx/conf.d/yacht.conf;
}
/etc/nginx/conf.d/yacht.conf
location /yacht {
return 302 /yacht/;
}
location /yacht/ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_http_version 1.1;
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 https;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:8000;
proxy_redirect http:// https://;
proxy_buffering off;
proxy_request_buffering off;
proxy_set_header Origin '';
client_max_body_size 0;
rewrite ^/css(/.*)$ /yacht$1 break;
rewrite ^/js(/.*)$ /yacht$1 break;
rewrite ^/img(/.*)$ /yacht$1 break;
rewrite ^/api(/.*)$ /yacht$1 break;
}
location /api {
proxy_pass http://127.0.0.1:8000/api;
}