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

Proxy single file #1029

Closed
blackliner opened this issue Apr 19, 2021 · 6 comments
Closed

Proxy single file #1029

blackliner opened this issue Apr 19, 2021 · 6 comments

Comments

@blackliner
Copy link

blackliner commented Apr 19, 2021

I would like to do something similar to get.docker.com, serve a static file that can be curl'd into bash to bootstrap some stuff. Is this possible with maybe custom nginx configs?

Preferably I would like to just forward this subdomain to a github raw file like this one:
https://github.com/blackliner/raspi_monitor/blob/main/install.sh

@p-fruck
Copy link

p-fruck commented May 3, 2021

Hi,
I'm not working on this project but I might have a solution for you. Under Proxy Hosts -> Custom locations you can redirect a specific subfolder to another resource, eg. https://example.com/subfolder -> https://github.com/someblob
You can also set / to be the subfolder if you want to redirect example.com to the github blob.

Please let me know if this helped you 😉

@blackliner
Copy link
Author

blackliner commented May 6, 2021

Cool, it works for the page: setup.lauraundflorian.de

But I cant get the raw version to work, but might be a github issue

@p-fruck
Copy link

p-fruck commented May 6, 2021

It seems to me like you are using a redirect host instead of a proxy host. Curl will (by default) not follow redirects. You can however tell curl to follow such redirects using curl -L example.com. If you use proxy hosts, you are not redirecting your http/s traffic, so it should work.
Keep in mind that you have to proxy your incoming http traffic to the raw github file! If you force SSL redirection on your host, you once again have to tell curl to use the -L flag!

Edit:
It does indeed not work out of the box by setting the location, but I have a have a configuration example for you.

  • Add a new proxy host
  • Set schema to http
  • Give it some host and port (the acutally do not matter if you rewrite / location)
  • In the advanced tab, add the following custom nginx config:
    location / {
        proxy_pass https://raw.githubusercontent.com/blackliner/raspi_monitor/main/install.sh;
        proxy_redirect off;
        add_header Content-Type text/plain;
    }

@chaptergy chaptergy reopened this May 12, 2021
@chaptergy chaptergy changed the title serve static file Proxy single file May 12, 2021
@chaptergy
Copy link
Collaborator

Maybe this helps: #320

@blackliner
Copy link
Author

Maybe this helps: #320

sweet, that did it!! thanks alot!

Copy link

Issue is now considered stale. If you want to keep it open, please comment 👍

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

No branches or pull requests

3 participants