Skip to content

Publish a Service with a Direct Target

Expose an upstream service that is reachable from the p2pstream server as a public HTTPS hostname.

Use This When

Use a direct proxy target when the upstream origin is reachable from the VPS or host running p2pstream.

Example:

RoleValue
Upstream originhttps://app.internal:8443
Public URLhttps://app.example.com

Prerequisites

  • p2pstream is running and you can log in to management.
  • Public DNS for app.example.com points to the p2pstream host.
  • The p2pstream server/container can reach https://app.internal:8443.
  • Docker publishes 443:443 if you use the default HTTPS listener.

Steps

  1. In Proxy, keep or create an HTTPS listener:

    FieldValue
    Namepublic-https
    ProtocolHTTPS
    Bind addressempty
    Port443
    EnabledOn
  2. Create a route for the hostname:

    FieldValue
    Listenerpublic-https
    Priority10
    Host patternapp.example.com
    Path prefix/
    ActionForward
    EnabledOn
  3. Add a proxy target to that route:

    FieldValue
    Nameapp
    TypeProxy
    TransportDirect
    URLhttps://app.internal:8443
    Priority group0
    Weight100
    TLS skip verifyOff unless this is a controlled internal certificate exception
    EnabledOn

    If the upstream needs custom headers, use target upstream request headers. If it needs HTTP basic auth, use target upstream basic auth instead of manually adding Authorization.

    p2pstream route editor showing a direct proxy target for an app route
    The direct target editor is where the server-owned upstream URL, load-balancing settings, timeout, health check, and origin TLS policy are reviewed before publishing the route.
  4. Open TLS and add a certificate mapping for app.example.com.

    Validation pathUse when
    HTTP-01Port 80 reaches p2pstream.
    TLS-ALPN-01Port 443 reaches p2pstream.
    DNS-01You need wildcard certificates or cannot expose validation ports.
    p2pstream TLS certificate mapping modal showing HTTP challenge, Let's Encrypt CA, hostname pattern, and listener selection
    The TLS mapping dialog binds the public hostname to the HTTPS listener and selects the ACME validation method and CA.

Verification

Run:

bash
curl -I https://app.example.com

Then check Overview for request counts and status classes. If you need request-stage details, open Traffic, enable tracing, repeat the request, and inspect the selected route target.

p2pstream traffic trace request details modal showing route target and upstream response metadata
The trace details modal confirms which route and target handled the request, whether cache was involved, and what response metadata came back from the upstream.

Troubleshooting

SymptomCheck
502 Bad GatewayTest the target URL from the p2pstream server/container.
503 Service UnavailableConfirm the route has an enabled available target; check target health if health checks are enabled.
Fallback/self-signed certificateAdd or fix the TLS certificate mapping for the requested hostname.
Route does not matchConfirm listener, host pattern, path prefix, and priority.

For frontend assets such as CSS, JavaScript, images, and fonts, configure public asset caching under Traffic Policy -> Cache. See Public Asset Cache.

Next Steps

Operations documentation for self-hosted p2pstream deployments.