Caddy Reverse Proxy Setup

I’m trying to setup Caddy as a reverse proxy to my apidog docs. Here is the Caddyfile block. However, when I visit the site https://walletapi.hypercore.one the site never loads.

walletapi.hypercore.one {
    # Handle /swagger path
    reverse_proxy /swagger/* https://localhost:5001{
        transport http {
            tls_insecure_skip_verify
        }
    }

    # Handle /api path
    reverse_proxy /api/* https://localhost:5001 {
        transport http {
            tls_insecure_skip_verify
        }
    }

    # Default handler for all other requests (root path /)
    reverse_proxy / http://493834.apidog.io {
        header_up X-Apidog-Project-ID 493834
    }
}

when I curl https://walletapi.hypercore.one -k I do see the message

<noscript>Sorry, we need js to run correctly!</noscript>

Also when I try to visit http://493834.apidog.io I get the message “This document does not exist or has been deleted”. Im confident the Proejct-ID is correct however.

Any thoughts on what is wrong here?

Also


I can access the url successfully. However, I observed that my browser automatically redirected http to https. Does it work if you use https instead of http to access?

I’ve tried it both ways. I just updated the Caddyfile and get the same result.

walletapi.hypercore.one {
    # Handle /swagger path
    reverse_proxy /swagger/* https://localhost:5001 {
        transport http {
            tls_insecure_skip_verify
        }
    }

    # Handle /api path
    reverse_proxy /api/* https://localhost:5001 {
        transport http {
            tls_insecure_skip_verify
        }
    }

    reverse_proxy / https://493834.apidog.io {
        header_up X-Apidog-Project-ID 493834
        header_up Host {http.reverse_proxy.upstream.hostport}
    }
}

Thanks for the feedback, we will look into the issue.

Thank you for the feedback. Please follow the steps below to modify the configuration and see if the issue can be resolved:

Firstly, Refer to the configuration in the help document at Custom domain - Apidog Docs, change the “https” in the reverse_proxy configuration to “http”.
Secondly, Remove the header_up Host configuration.


thank you and sorry for the late response. I’ve updated those setting and reloaded the Caddyfile


the problem seems to persist

I’ve also tried these settings which are in line with the Docs but translated to Caddy.


the location of the / might be missing an *. please refer to the configuration shown in the image for reference.


:8080 {
handle_path /your_path/* {
respond “do something”
}
handle_path /api {
respond “Hello, world!”
}
handle_path /* {
reverse_proxy http://493834.apidog.io {
header_up X-Apidog-Project-ID “493834”
header_up Host “walletapi.hypercore.one”
transport http {
dial_timeout 30s
}
}
}
}

amazing. thank you so much. these changes worked.

you were right, /* was the solution.