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

Default domain feature: Allow secondary domain #405

Open
readtedium opened this issue Nov 21, 2023 · 2 comments
Open

Default domain feature: Allow secondary domain #405

readtedium opened this issue Nov 21, 2023 · 2 comments

Comments

@readtedium
Copy link

Bouncing off the great work done in #309, is it possible to add an override, or maybe an alternate? I think it might come in handy to have a default base URL but if you need to grab from a different domain than the default.

I mostly grab from one domain, but sometimes I grab from a second; currently the tool forces me to use long URLs for both, but I think adding the option for additional variables could be useful. One way I could see it working:

In .env:

HTTP_LOADER_BASE_URL=https://raw.githubusercontent.com/cshum/imagor/master
HTTP_LOADER_ALT_URL=https://img.youtube.com

First example (uses BASE_URL):

http://localhost:8000/unsafe/fit-in/200x150/filters:fill(yellow):watermark(testdata/gopher-front.png,repeat,bottom,0,40,40)/testdata/dancing-banana.gif

Second example (uses ALT_URL):

http://localhost:8000/unsafe/trim/700x394/alt_url/vi/jNQXAC9IVRw/hqdefault.jpg

Third example (with a watermark pulled from the base URL):

http://localhost:8000/unsafe/trim/700x394/filters:watermark(/testdata/dancing-banana.gif,0,0,25)/alt_url/vi/jNQXAC9IVRw/hqdefault.jpg

The one challenge I see is that if there’s a folder named ALT_URL it would override this, but I do think there’s probably a way to solve this, maybe by using a filter?

@AlekseyArh
Copy link

AlekseyArh commented Dec 2, 2023

@readtedium Have you considered nginx proxy as a solution?

location /vi/ {
        proxy_pass https://img.youtube.com;
}

curl localhost/vi/jNQXAC9IVRw/hqdefault.jpg

@readtedium
Copy link
Author

This required me to set up a separate NGINX proxy to reach my S3 bucket (this was a good guide), but once I did that, I found @AlekseyArh’s suggestion to be a good solve.

This idea may still be useful for those who don’t want to have to manage an additional NGINX proxy, though.

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