Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template ".Req.URL" components are empty #6696

Open
alf5 opened this issue Nov 17, 2024 · 0 comments
Open

Template ".Req.URL" components are empty #6696

alf5 opened this issue Nov 17, 2024 · 0 comments

Comments

@alf5
Copy link

alf5 commented Nov 17, 2024

According to https://caddyserver.com/docs/modules/http.handlers.templates

.Req.URL should return "Scheme", "Port", etc...

I have a file index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Main</title>
  </head>
  <body>
      <h3>URL="{{.Req.URL}}"</h3>
      <h3>host="{{.Req.URL.Host}}"</h3>
      <h3>scheme="{{.Req.URL.Scheme}}"</h3>
      <h3>port="{{.Req.URL.Port}}"</h3>
  </body>
</html>

produces:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Main</title>
  </head>
  <body>
      <h3>URL="/"</h3>
      <h3>host=""</h3>
      <h3>scheme=""</h3>
      <h3>port=""</h3>
  </body>
</html>

The URL typed in the browser is "https://my.super-duper-site.com/" (i.e. its not localhost :) )

I believe this is a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant