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

Simple HTTP Proxy solution and potential document improvement #637

Closed
mistrpokr opened this issue Jun 7, 2022 · 1 comment
Closed

Simple HTTP Proxy solution and potential document improvement #637

mistrpokr opened this issue Jun 7, 2022 · 1 comment

Comments

@mistrpokr
Copy link

Please describe your suggestion, and the problem it'd solve.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

TLDR: Passing MOJO_PROXY=1 env into LLR's startup context lets it use the HTTP proxy from shell environmental variables automatically, without any code changes.
User under censorship or using a VPN for privacy purposes can deliberately opt to use it when running Docker containers (or running natively), thus it would be nice to document this behavior in installation guide sections after testing for any potential drawbacks.

Additional context
Add any other context or screenshots about the feature request here.

Hi! I just discovered LANraragi this afternoon and so far the Docker experience has been great! Except for the part with metadata plugins: that is, as a user behind the GFW it's not quite possible to access e-hentai and friends directly without a proxy.
With some experiments I quickly discovered that LLR, with its Perl/Mojo backend, does not respect Linux environmental variables by default, and that's the reason why setting http(s)_proxy envs manually or with the official way does not work.
I searched in the Discord server and saw some other Chinese guy solving this problem with EHentai download plugin by adding a line in Minion.pm(Line 164, Commit 0edd1b2).

$ua->proxy->http('http://172.17.0.1:1082')->https('http://172.17.0.1:1082');

However, I was not able to fix the metadata plugin with this solution. Following a link to Mojo's documentation, I found the following description:

Check environment variables HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY and no_proxy for proxy information. Automatic proxy detection can be enabled with the MOJO_PROXY environment variable.
And it works. After setting MOJO_PROXY=1 it seems LLR would actually use the proxy from envs.

For reference, here's a minimum docker-compose file demonstrating the above setup:

---
version: "2.1"
services:
  lanraragi:
    image: difegue/lanraragi:latest
    container_name: lanraragi
    environment:
      - http_proxy=http://192.168.10.186:1082
      - https_proxy=http://192.168.10.186:1082
      - MOJO_PROXY=1
    volumes:
      - [database]:/home/koyomi/lanraragi/database
      - [content]:/home/koyomi/lanraragi/content
    ports:
      - 7070:3000
    restart: unless-stopped

Thanks for reviewing this issue, and keep up the great work!

Difegue added a commit that referenced this issue Jun 7, 2022
@Difegue
Copy link
Owner

Difegue commented Jun 7, 2022

Thank you for the detailed writeup! I'll admit I didn't know about MOJO_PROXY all this time, so it's great to know an easy solution exists for proxy usage.

I've added MOJO_PROXY=1 as a default in the Docker container builds, so hopefully all users will have to do now is set the standard http_proxy variables. ✌️
The docs have been updated as well.

@Difegue Difegue closed this as completed Jun 7, 2022
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