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 {
    #... 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;


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…

List local disks

GET-CimInstance -query "SELECT * from Win32_DiskDrive" DeviceID Caption Partitions Size Model -------- -------...

Create ISO using Powershell

Usage New-IsoFile -NewIsoFilePath C:\tmp\Hyper-V.iso-sources -ImageName Hyper-V -SourceFilePath 'C:\tmp\Hyper-V'...