-
Notifications
You must be signed in to change notification settings - Fork 487
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
feat: Added doc for for web server deployment #1813
Conversation
Hey, here’s your docs preview: https://clerk.com/docs/pr/1813 |
Would "Deploying behind a proxy" be a better way to frame this? |
That might be. I think its more accurate, but I am wondering if the people who will need it might not realize they are using a proxy. eg, Caddy calls itself a web server on its main page. nginx says web server and reverse proxy. Also not everyone realizes that Docker is proxying external traffic to internal services. My gut feeling is to leave it as if, but make sure that the doc itself mentions proxy and reverse proxy for searches. |
I think the more explicit/specific the title might help people coming to us with these issues. I tend to agree with Roy in this case, the type of people that I tend to help that need a doc like this are not super familiar with the infrastructure they are using or understand what it is doing fully. |
agreed with braden here |
I will get a new version up tomorrow. I'll make sure the content should be good for searches. |
description: Learn how to deploy a Clerk app to a web server using proxies and reverse proxies like nginx or Caddy, or using Docker | ||
--- | ||
|
||
When deploying a Clerk app beind a proxy, you may need to proxy two headers for Clerk to work correctly. The two headers that you must forward are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first sentence says they "may need to" proxy the two headers. the second sentence says they "must" forward the headers.
is it required, or is it not required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use more assured its required tense, I think its safe to assume it needed in nearly if not all network configs.
|
||
## How to test if the headers are forwarded correctly: | ||
|
||
You can console log the `X-forwarded-host` and `X-forwarded-proto` to check what the value is. The following example is for Next.js. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the values be, so that the user knows that the forwarding worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
X-Forwarded-Host
: The original host that the client requested, like if your public domain isexample.com
, thenX-Forwarded-Host
should appear asexample.com
-
X-Forwarded-Proto
: The original protocol used by the client. If your site is served over HTTPS, thenX-Forwarded-Proto
should appear as https... Clerk requires HTTPS in Prod so it needs to be HTTPS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example expected output from the console log, assuming that the application's production domain is clerk.com
below. I'll add this to the PR now.
=========================
Request Headers
x-forwarded-host clerk.com
x-forwarded-proto https
=========================
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in ed19a2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've posted my docs review, lmk what you think! if you want to change it, feel free, or if you like it, feel free to merge! 😸💖
Important
🔎 Previews:
Explanation:
This creates a new Deployment doc covering the two headers that must be forwarded from the server/container to the application for Clerk to work correctly.
This PR:
Lists the headers, has a basic nginx example and covers how to test that the config is correct.
Checklist