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

How to run rss-proxy behind an nginx reverse proxy #39

Open
happening-primal opened this issue Jan 29, 2022 · 5 comments
Open

How to run rss-proxy behind an nginx reverse proxy #39

happening-primal opened this issue Jan 29, 2022 · 5 comments

Comments

@happening-primal
Copy link

happening-primal commented Jan 29, 2022

Great tool.

Been struggling a bit to get rss-proxy to run behind an nginx reverse proxy (SWAG). The issue that arises is that rss-proxy appears to redirect to the root directory of the web server. Runs fine without the reverse proxy (http://ip_address:3000) but is exposed to the world.

My configuration:

rss-proxy running in a docker container
SWAG as the nginx reverse proxy also running in a docker container

I've used the reverse proxy to rewrite some portions of the html to route to the correct source (from / to /rss-proxy) and this gets the rendering of the page partially completed. This results in the below page source. The left panel comes up fine (Please enter the URL of the website you want an RSS Feed from) however, a call to core.js.pre-build-optimizer.js causes the right panel to fail

Http failure during parsing for https://redacted_domain_name/
Most likely the website is JavaScript generated, which is not supported by rss-proxy directly. Check the documentation for further help

Again it returns a reference back to the root directory of the web server and does not allow nginx 'sub_filter' command to make replacements.

Any help much appreciated.

================================================
nginx proxy-confs snippet:

sub_filter 'src="/'  'src="/rss-proxy/';
sub_filter_once off;

================================================
proxied page source:

<!doctype html>

<title>RSS-proxy playground</title> <script src="rss-proxy/runtime-es2015.cdfb0ddb511f65fdc0a0.js" type="module"></script><script src="rss-proxy/runtime-es5.cdfb0ddb511f65fdc0a0.js" nomodule defer></script><script src="rss-proxy/polyfills-es5.790a3785e4df737dcc1e.js" nomodule defer></script><script src="rss-proxy/polyfills-es2015.9f9a7e9d82395a8b4bf0.js" type="module"></script><script src="rss-proxy/main-es2015.73d3d495c2160e54d3e6.js" type="module"></script><script src="rss-proxy/main-es5.73d3d495c2160e54d3e6.js" nomodule defer></script>

================================================
core.js.pre-build-optimizer.js error - fetching content from web root...

ERROR Error: Uncaught (in promise): Up: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":200,"statusText":"OK","url":"https://redacted_domain_name/","ok":false,"name":"HttpErrorResponse","message":"Http failure during parsing for https://redacted_domain_name/","error":{"error":{},"text":"<html lang="en"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta ...

@Yetangitu
Copy link

You can use a single domain to serve both the proxy as well as the "playground" (which runs in a development server which is not tested for security problems so make sure to put it behind a password). The following example assumes that:

  • you use the domain rssproxy.example.org
  • you're using a normal nginx install (not in a container/docker/whatever)
  • the actual rss-proxy install (both services) runs on daemon.example.org

Use something along these lines:

server {
	listen 80;
	server_name rssproxy.example.org;

	include /etc/nginx/snippets/enforcehttps.conf;
}

server {
	listen 443 ssl http2;
	server_name rssproxy.example.org;

	ssl_certificate /etc/letsencrypt/live/rssproxy.example.org/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/rssproxy.example.org/privkey.pem;

	location /api {
		include /etc/nginx/proxy_params;
		proxy_redirect http:// https://;
		proxy_pass http://daemon.example.org:3000;
	}
	location / {
                satisfy any;
                # allow 192.168.1.0/24; # allows internal access without password
                auth_basic "RSSProxy";
                auth_basic_user_file /etc/nginx/rssproxy.auth;
                include /etc/nginx/proxy_params;
		proxy_redirect http:// https://;
		proxy_pass http://daemon.example.org:4200;
	}
}

If you wonder what is in those referenced included files:

$ cat /etc/nginx/proxy_params 
# global proxy conf
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass_request_headers on;
$ cat /etc/nginx/snippets/enforcehttps.conf 
location / {
	return 301 https://$server_name$request_uri;
}

@damoeb
Copy link
Owner

damoeb commented Jul 11, 2022

Sry for the late response. Do you mind checking again with the new version 2? I added my ngix.conf reverse proxy

@BachDANG
Copy link

Can i run it directly from code without creating docker image?

@teotimepacreau
Copy link

having the same problem with version 2. still don't work with nginx-proxy-manager.

502 Bad Gateway
openresty

@happening-primal
Copy link
Author

having the same problem with version 2. still don't work with nginx-proxy-manager.

502 Bad Gateway
openresty

I fixed this some time back by using a subdomain rather than a subfolder. Hope that helps.

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

5 participants