[PR #24870] fix: basepath did not read from the environment variable #30836

Closed
opened 2026-02-21 20:48:19 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/24870

State: closed
Merged: Yes


Fixes: #24871

Summary

This pull request refactors how the basePath configuration is handled in the Next.js app. The main change is to remove the separate var-basePath.js file and directly use environment variables for basePath in both next.config.js and utility files. This simplifies the configuration and reduces duplication.

Configuration refactoring:

  • Removed the web/utils/var-basePath.js file and its exports, eliminating duplication of the basePath logic.
  • Updated web/next.config.js to set basePath directly from the NEXT_PUBLIC_BASE_PATH environment variable, instead of importing it from var-basePath.js.
  • Changed the default export of basePath in web/utils/var.ts to use the environment variable, aligning it with the new configuration approach.

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/24870 **State:** closed **Merged:** Yes --- Fixes: #24871 ## Summary This pull request refactors how the `basePath` configuration is handled in the Next.js app. The main change is to remove the separate `var-basePath.js` file and directly use environment variables for `basePath` in both `next.config.js` and utility files. This simplifies the configuration and reduces duplication. Configuration refactoring: * Removed the `web/utils/var-basePath.js` file and its exports, eliminating duplication of the `basePath` logic. * Updated `web/next.config.js` to set `basePath` directly from the `NEXT_PUBLIC_BASE_PATH` environment variable, instead of importing it from `var-basePath.js`. * Changed the default export of `basePath` in `web/utils/var.ts` to use the environment variable, aligning it with the new configuration approach. ## Screenshots | Before | After | |--------|-------| | ... | ... | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:48:19 -05:00
yindo closed this issue 2026-02-21 20:48:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30836