[GH-ISSUE #1220] Fallback to the Internet if Images cant be found local #347

Open
opened 2026-02-27 14:51:26 +03:00 by kerem · 4 comments
Owner

Originally created by @oe3gwu on GitHub (Mar 21, 2023).
Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/1220

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
If I change "set live_endpoint" to a local endpoint, netboot shoot try to find the image. If the image isnt found locally, an automatically fallback to https://github.com/netbootxyz should happen. Currently the Boot Process fails.

Describe alternatives you've considered
Download all the Images, thats nice but really not a solution for a Raspberry Pi Docker Container.

Additional context
image

Originally created by @oe3gwu on GitHub (Mar 21, 2023). Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/1220 **Is your feature request related to a problem? Please describe.** No. **Describe the solution you'd like** If I change "set live_endpoint" to a local endpoint, netboot shoot try to find the image. If the image isnt found locally, an automatically fallback to https://github.com/netbootxyz should happen. Currently the Boot Process fails. **Describe alternatives you've considered** Download all the Images, thats nice but really not a solution for a Raspberry Pi Docker Container. **Additional context** ![image](https://user-images.githubusercontent.com/17622063/226728431-f9963e6c-491b-4c5d-89c2-d4730a22470c.png)
Author
Owner

@miawgogo commented on GitHub (Jan 24, 2024):

I have managed to modify the nginx config to do this on my instance with the following settings

server {
        listen [NGINX_PORT];
        resolver 8.8.8.8;
        location / {
                root /assets;
                autoindex on;
                try_files $uri $uri/ @fallback;
        }
        location @fallback{
            rewrite  ^/(.*) /netbootxyz/$1 break;
            proxy_pass https://github.com;
            #proxy_redirect / /;
            proxy_intercept_errors on;
            error_page 301 302 307 = @handle_redirect;
        }
        location @handle_redirect {
            set $saved_redirect_location '$upstream_http_location';
            proxy_pass $saved_redirect_location;
        }
}

its not the best as its a combination of stuff from stackoverflow and some of my own config. the fallback is what redirects it to the github mirror if it cant find a file and the @handle_redirect is to hide the redirect from github.com to objects.githubusercontent.com. Ive not added caching to my config yet, but i will at somepoint to help with performance

<!-- gh-comment-id:1907964133 --> @miawgogo commented on GitHub (Jan 24, 2024): I have managed to modify the nginx config to do this on my instance with the following settings ```nginx server { listen [NGINX_PORT]; resolver 8.8.8.8; location / { root /assets; autoindex on; try_files $uri $uri/ @fallback; } location @fallback{ rewrite ^/(.*) /netbootxyz/$1 break; proxy_pass https://github.com; #proxy_redirect / /; proxy_intercept_errors on; error_page 301 302 307 = @handle_redirect; } location @handle_redirect { set $saved_redirect_location '$upstream_http_location'; proxy_pass $saved_redirect_location; } } ``` its not the best as its a combination of stuff from stackoverflow and some of my own config. the fallback is what redirects it to the github mirror if it cant find a file and the `@handle_redirect` is to hide the redirect from `github.com` to `objects.githubusercontent.com`. Ive not added caching to my config yet, but i will at somepoint to help with performance
Author
Owner

@grmrgecko commented on GitHub (Mar 6, 2024):

To add caching:

proxy_cache_path        /assets/cache keys_zone=fallback_cache:30720m levels=1:2 max_size=30720m inactive=30d;
proxy_buffer_size       128k;
proxy_buffers           4 256k;
proxy_busy_buffers_size 256k;

server {
        listen 80;
        resolver 8.8.8.8;
        location / {
                root /assets;
                autoindex on;
                try_files $uri $uri/ @fallback;
        }
        location @fallback {
            rewrite  ^/(.*) /netbootxyz/$1 break;
            proxy_cache_revalidate on;
            proxy_cache            fallback_cache;
            proxy_cache_valid      200 30d;
            proxy_cache_use_stale  error timeout invalid_header updating;
            proxy_pass             https://github.com;
            proxy_intercept_errors on;
            error_page 301 302 307 = @handle_redirect;
            add_header X-Netboot-Cache $upstream_cache_status;
        }
        location @handle_redirect {
            set $saved_redirect_location '$upstream_http_location';
            proxy_cache_revalidate on;
            proxy_cache            fallback_cache;
            proxy_cache_valid      200 30d;
            proxy_cache_use_stale  error timeout invalid_header updating;
            proxy_pass $saved_redirect_location;
            add_header X-Netboot-Cache $upstream_cache_status;
        }
}
<!-- gh-comment-id:1981276807 --> @grmrgecko commented on GitHub (Mar 6, 2024): To add caching: ```nginx proxy_cache_path /assets/cache keys_zone=fallback_cache:30720m levels=1:2 max_size=30720m inactive=30d; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; server { listen 80; resolver 8.8.8.8; location / { root /assets; autoindex on; try_files $uri $uri/ @fallback; } location @fallback { rewrite ^/(.*) /netbootxyz/$1 break; proxy_cache_revalidate on; proxy_cache fallback_cache; proxy_cache_valid 200 30d; proxy_cache_use_stale error timeout invalid_header updating; proxy_pass https://github.com; proxy_intercept_errors on; error_page 301 302 307 = @handle_redirect; add_header X-Netboot-Cache $upstream_cache_status; } location @handle_redirect { set $saved_redirect_location '$upstream_http_location'; proxy_cache_revalidate on; proxy_cache fallback_cache; proxy_cache_valid 200 30d; proxy_cache_use_stale error timeout invalid_header updating; proxy_pass $saved_redirect_location; add_header X-Netboot-Cache $upstream_cache_status; } } ```
Author
Owner

@gissf1 commented on GitHub (Nov 2, 2024):

I skipped the caching for now on my system, but I think you can simplify the nginx config (or at least it worked for me) by doing this to simply redirect the client to the public live server:

server {
        listen 80;
        location / {
                root /assets;
                autoindex on;
                try_files $uri $uri/ @fallback;
        }
        location @fallback{
                return   307 https://github.com/netbootxyz$request_uri;
        }
}
<!-- gh-comment-id:2452936397 --> @gissf1 commented on GitHub (Nov 2, 2024): I skipped the caching for now on my system, but I think you can simplify the nginx config (or at least it worked for me) by doing this to simply redirect the client to the public live server: ```nginx server { listen 80; location / { root /assets; autoindex on; try_files $uri $uri/ @fallback; } location @fallback{ return 307 https://github.com/netbootxyz$request_uri; } } ```
Author
Owner

@LATINO-BICEPS commented on GitHub (Nov 29, 2025):

@grmrgecko Is this still working for you? My cache dir is growing but nothing is being pulled from it. There are no changes in my nginx config and I have modified local-vars.ipxe to set live_endpoint http://x.x.x.x:8080.

<!-- gh-comment-id:3591566286 --> @LATINO-BICEPS commented on GitHub (Nov 29, 2025): @grmrgecko Is this still working for you? My cache dir is growing but nothing is being pulled from it. There are no changes in my nginx config and I have modified local-vars.ipxe to `set live_endpoint http://x.x.x.x:8080`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/netboot.xyz#347
No description provided.