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

Reverse proxy compatability #32

Closed
jmctune opened this issue Mar 19, 2018 · 7 comments
Closed

Reverse proxy compatability #32

jmctune opened this issue Mar 19, 2018 · 7 comments

Comments

@jmctune
Copy link

jmctune commented Mar 19, 2018

Would love a supported way to reverse proxy LANraragi over my Nginx server to give me the ability to read on the go.

I've got a really janky way of it working right now, but I'm missing the page style.

My location blocks:

location /manga/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/;
}

location /js/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/js/;
}

location /js/vendor/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/js/vendor/;
}

location /css/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/css/;
}

location /css/vendor/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/css/vendor/;
}
@Difegue
Copy link
Owner

Difegue commented Mar 19, 2018

From what I'm seeing, you need to add the following location block to get themes:

location /themes/ {
	include /config/nginx/auth_basic.conf;
	proxy_pass http://172.20.0.8:3000/themes/;
}

As for specific reverse proxy support, I can't really do anything more than what's already there, i.e specifying port/interfaces for the server to listen on.

I don't know much about nginx, but if it's like apache your best shot is to map all of port 3000 to a subdomain, if possible:
https://whatididtodowhatidid.wordpress.com/2014/03/14/subdomains-for-ports-on-same-ubuntu-server-with-nginx-reverse-proxy/

@jmctune
Copy link
Author

jmctune commented Mar 19, 2018

Thanks for the really quick response there.

That was the missing piece. Themes are pulling in now. All of the above was required, along with your additional location block. Thanks a lot!

@jmctune jmctune closed this as completed Mar 19, 2018
@fullmetal1
Copy link

So I just tried this and found that there's a lot more locations that would need to be passed for this to work now. Would it be possible to implement a base url config option like many other self hosted webservers have?

@Difegue
Copy link
Owner

Difegue commented Nov 13, 2020

You can find a cleaner reverse proxy nginx config here: https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#warning-reverse-proxies

@fullmetal1
Copy link

So base url is 'will not support'?

@Difegue
Copy link
Owner

Difegue commented Nov 14, 2020

Not for now since there's no built-in support for it in mojo and I'd have to whip up something -- Feel free to make a new issue about it though!

https://stackoverflow.com/questions/31864849/how-do-i-set-the-base-url-for-my-proxied-app
https://stackoverflow.com/questions/25170147/base-url-in-mojolicious-template-rendering

@fullmetal1
Copy link

Seems like the mojolicious guys don't want to add direct support for base-url

mojolicious/mojo#484

However, there is documentation on using the before-dispatch hook to rewrite URLs.

https://docs.mojolicious.org/Mojolicious/Guides/Cookbook#Rewriting

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

3 participants