Reverse Proxy Cups in Nginx

by | Jun 24, 2020 | IT Tips, Wordpress | 0 comments

The process is similar to my previous post on proxying a sub directory back to the root.

For example

https://example.com/test => proxies back to / in the docker container

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
upstream cups-endpoint {
    # in my case I'm using cups inside
    # a docker container and exposing
    # it's default port 631 as 650
    server 127.0.0.1:650;
}
 
server {
    #... snippage
    location /app/cups/ {
        proxy_set_header Accept-Encoding "";
        set $subdir app;
        sub_filter 'href="/' 'href="/$subdir/cups/';
        sub_filter 'ACTION="/' 'ACTION="/$subdir/cups/';
        sub_filter 'URL=/' 'URL=/$subdir/cups/';
        sub_filter_once off;
 
        # you need to request CUPS via https
        # to do admin functions
        proxy_pass https://cups-endpoint/;
        proxy_redirect off;
        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-Host $server_name;
    }
}

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.