Skip to content

Conversation

@wonyx
Copy link

@wonyx wonyx commented Oct 6, 2025

Summary

fixed #177

This pull request introduces the WithTrustForwardedHeader option to the NewLogtoClient constructor. When this option is set to true, the Logto client will trust X-Forwarded-* headers (e.g., X-Forwarded-Host, X-Forwarded-Proto) to correctly construct the request's origin URL.

This is particularly useful for applications running behind a reverse proxy or load balancer, ensuring that redirect URIs for the sign-in and sign-out processes are generated with the correct public-facing scheme and host.

Usage example

logtoClient := client.NewLogtoClient(
	logtoConfig,
	storage,
	client.WithTrustForwardedHeader(true),
)

Testing

added unittest cases.

Also I have been tested it in firebase hosting with cloud run environment that described in #177 .

Checklist

  • [ ] .changeset
  • unit tests
  • integration tests
  • [ ] necessary TSDoc comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feature request: Support running behind a reverse proxy

1 participant