cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
8.4k stars 729 forks source link

support protocol relative service url #1189

Open realies opened 3 months ago

realies commented 3 months ago

at the moment config.yml requires the scheme of the internal service to be specified, this prevents internal services, like reverse proxies, to determine which protocol is used and behave accordingly; can http and https be supported for a single service? e.g. a protocol-relative URL:

tunnel: ***
credentials-file: /home/nonroot/.cloudflared/***.json

ingress:
  - hostname: "*.example.com"
    service: //nginx-proxy-manager

  - service: http_status:404
0xcryp70 commented 3 months ago

not possible for a single service, but you can use a single service and handle the rest of it with a reverse proxy or load balancer

realies commented 3 months ago

can you provide an example, @0xcryp70? how would the service know if the origin request was over http or https?

0xcryp70 commented 3 months ago

usually with headers like x_forward, it can be handled on headers, like

location / { if ($http_x_forwarded_proto = 'https') { } if ($http_x_forwarded_proto = 'http') { }