docker-rdp-calibre
docker-rdp-calibre copied to clipboard
Reverse Proxy
Hey There, I'm currently trying to setup CalibreRDP to be accessible through a reverse proxy. I've got the following set in my nginx conf but I get a 404 error when trying to access it using https://mediaserver.example.com/calibre
location /calibre {
auth_request /auth-admin;
proxy_pass http://192.168.0.1:12004;
include /config/nginx/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;
}
Is there some additional configuration I should be doing?
Try changing the proxy pass variable to http://192.168.0.1:12004/#/client/c/Calibre
I've successfully been able to reverse proxy the calibre content server, but I can't get the GUI reverse proxied. When I try to hit the route, I get a 404 Error from Tomcat, saying /#/client/c/Calibre can't be found. This is the location setup I'm using.
location /apps/calibregui/ {
proxy_pass http://127.0.0.1:9906/#/client/c/Calibre;
proxy_set_header Host $host;
auth_basic "MyServer";
auth_basic_user_file /etc/nginx/.htpasswd;
# This is a collection of proxy rules I've collected for my various apps
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# SSL proxying headers
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Any advice appreciated.
@dptsolutions - not sure if you ever got this figured out ... but i was able to get it working with the following: Adjust your IP in place accordingly, or Port if not the standard port
#================= CALIBRE-GUI ===================#
location /calibre_gui/ {
proxy_pass http://calibre:8080/;
include /config/nginx/auth/auth-admin.conf;
include /config/nginx/proxy.conf;
}
Proxy.conf contents:
client_max_body_size 10m;
client_body_buffer_size 128k;
#Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# Advanced Proxy Config
send_timeout 5m;
proxy_read_timeout 240;
proxy_send_timeout 240;
proxy_connect_timeout 240;
# Basic Proxy Config
proxy_set_header Host $host:$server_port;
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; ## Swapped with line below for parity among others
proxy_redirect http:// $scheme://;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;
proxy_buffers 32 4k;
@1activegeek,
Thanks! The problem was my proxy_pass line. Setting it to proxy_pass http://127.0.0.1:9906/; was the sauce. Just needed the bloody trailing slash!
Though, that said, I am getting this error in the console in dev tools:
/apps/calibregui/#/client/c/Calibre:1 Refused to display 'https://mydomain.net/apps/calibregui/app/element/templates/blank.html' in a frame because it set 'X-Frame-Options' to 'deny'.
VM2513:66 Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLObjectElement': Blocked a frame with origin "https://mydomain.net" from accessing a cross-origin frame.
at HTMLObjectElement.contentDocumentDesc.get [as contentDocument] (<anonymous>:66:14)
at HTMLObjectElement.d (https://mydomain.net/apps/calibregui/app.js:82:89301)
I am proxying the gui at https://mydomain.net/apps/calibregui. Only effect of this seems to be that the window does not resize correctly. But any help in resolving it would be appreciated.
@dptsolutions glad that helped! The slashes are always a pain to iron out. It's amazing how different nuances like that are the difference between working/non-working configs. Shameless plug - nginx-config-collection is a repo I'm working on building out to be a wiki of known working nginx configs for various apps. May be some others you use.
While it seems odd that the error you mentioned would cause an issue with just the resizing of the window. X-Frame-Options is usually a setting around allowing an app to be iFramed inside a page. In this case I'm not sure why that would appear since nginx isn't iFraming the page. Are you using some other app/site/page to iFrame this? If you want to remove this option for this app, add into the location directive this line:
proxy_hide_header X-Frame-Options
Beware however that this is less secure because someone could Frame your site inside their own and make it look legit. Just the warning, obviously you can determine your level of risk/exposure in doing so.