Written by James McDonald

June 24, 2020

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

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.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...