[PR #2127] [MERGED] fix: give the possibility to use internal webapp url in browserless requests (get-certificate-pdf and get-audit-logs-pdf) #2061

Closed
opened 2026-02-26 20:32:16 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2127
Author: @Matt0550
Created: 11/3/2025
Status: Merged
Merged: 11/22/2025
Merged by: @Mythie

Base: mainHead: fix/internal-url-browserless


📝 Commits (4)

  • 4e5f777 fix: now get certificate and get audit logs, uses internal webapp url for browserless requests
  • 7e3f122 Update packages/lib/constants/app.ts
  • e3177f8 Update render.yaml
  • 43cea9b Merge branch 'main' into fix/internal-url-browserless

📊 Changes

8 files changed (+17 additions, -7 deletions)

View changed files

📝 .env.example (+3 -1)
📝 docker/production/compose.yml (+1 -0)
📝 packages/lib/constants/app.ts (+2 -0)
📝 packages/lib/server-only/htmltopdf/get-audit-logs-pdf.ts (+3 -3)
📝 packages/lib/server-only/htmltopdf/get-certificate-pdf.ts (+3 -3)
📝 packages/tsconfig/process-env.d.ts (+2 -0)
📝 render.yaml (+2 -0)
📝 turbo.json (+1 -0)

📄 Description

Description

This pull request introduces the ability to use the internal webapp URL for Browserless requests (get-certificate-pdf and get-audit-logs-pdf).

Previously, all htmltopdf requests were made using the public webapp URL, which in some cases (such as when Cloudflare bot protection is enabled) caused the requests to be blocked.

With this fix, a new environment variable NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS has been added, allowing the application to decide whether to use:

  • NEXT_PRIVATE_INTERNAL_WEBAPP_URL (internal URL), or
  • NEXT_PUBLIC_WEBAPP_URL (public URL).

This provides more flexibility and resolves issues with bot protection or network restrictions.

I did not find any issue that corresponds to the problem I encountered.

Changes Made

  • Added new environment variable NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS (default false) and updated all deployment files.
  • Updated get-certificate-pdf.ts and get-audit-logs-pdf.ts logic to use the internal webapp URL when the new env variable is enabled.

Testing Performed

Tested both configurations:

  • With NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS=true → Browserless requests use NEXT_PRIVATE_INTERNAL_WEBAPP_URL.
  • With NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS=false (or unset) → Browserless requests use NEXT_PUBLIC_WEBAPP_URL.
  • Verified PDF generation for both get-certificate-pdf and get-audit-logs-pdf.
  • Confirmed that requests are no longer blocked by Cloudflare when using the internal URL.

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable (env example)
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2127 **Author:** [@Matt0550](https://github.com/Matt0550) **Created:** 11/3/2025 **Status:** ✅ Merged **Merged:** 11/22/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `fix/internal-url-browserless` --- ### 📝 Commits (4) - [`4e5f777`](https://github.com/documenso/documenso/commit/4e5f777eb20024a26a39327ad4178b09255fd592) fix: now get certificate and get audit logs, uses internal webapp url for browserless requests - [`7e3f122`](https://github.com/documenso/documenso/commit/7e3f1221949e63df40d7e189cb3a9219bad6f35e) Update packages/lib/constants/app.ts - [`e3177f8`](https://github.com/documenso/documenso/commit/e3177f84837f22e152425abc6ebc1c5b078c2501) Update render.yaml - [`43cea9b`](https://github.com/documenso/documenso/commit/43cea9b348de6d52bb67885f9e1c711f76f1722c) Merge branch 'main' into fix/internal-url-browserless ### 📊 Changes **8 files changed** (+17 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+3 -1) 📝 `docker/production/compose.yml` (+1 -0) 📝 `packages/lib/constants/app.ts` (+2 -0) 📝 `packages/lib/server-only/htmltopdf/get-audit-logs-pdf.ts` (+3 -3) 📝 `packages/lib/server-only/htmltopdf/get-certificate-pdf.ts` (+3 -3) 📝 `packages/tsconfig/process-env.d.ts` (+2 -0) 📝 `render.yaml` (+2 -0) 📝 `turbo.json` (+1 -0) </details> ### 📄 Description ## Description This pull request introduces the ability to use the internal webapp URL for Browserless requests (get-certificate-pdf and get-audit-logs-pdf). Previously, all htmltopdf requests were made using the public webapp URL, which in some cases (such as when Cloudflare bot protection is enabled) caused the requests to be blocked. With this fix, a new environment variable `NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS `has been added, allowing the application to decide whether to use: - `NEXT_PRIVATE_INTERNAL_WEBAPP_URL `(internal URL), or - `NEXT_PUBLIC_WEBAPP_URL` (public URL). This provides more flexibility and resolves issues with bot protection or network restrictions. ## Related Issue I did not find any issue that corresponds to the problem I encountered. ## Changes Made - Added new environment variable `NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS `(default false) and updated all deployment files. - Updated `get-certificate-pdf.ts` and `get-audit-logs-pdf.ts` logic to use the internal webapp URL when the new env variable is enabled. ## Testing Performed Tested both configurations: - With `NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS`=true → Browserless requests use `NEXT_PRIVATE_INTERNAL_WEBAPP_URL`. - With `NEXT_PUBLIC_USE_INTERNAL_URL_BROWSERLESS`=false (or unset) → Browserless requests use `NEXT_PUBLIC_WEBAPP_URL`. - Verified PDF generation for both get-certificate-pdf and get-audit-logs-pdf. - Confirmed that requests are no longer blocked by Cloudflare when using the internal URL. ## Checklist - [X] I have tested these changes locally and they work as expected. - [ ] I have added/updated tests that prove the effectiveness of these changes. - [X] I have updated the documentation to reflect these changes, if applicable (env example) - [X] I have followed the project's coding style guidelines. - [ ] I have addressed the code review feedback from the previous submission, if applicable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:16 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2061
No description provided.