Use public API_BASE for OnlyOffice URLs and revert IP rewriting hack to fix Docker networking
Some checks failed
Automated Container Build / build-and-push (push) Failing after 1m7s
Some checks failed
Automated Container Build / build-and-push (push) Failing after 1m7s
This commit is contained in:
parent
7de186ee05
commit
fd26a165ba
2 changed files with 3 additions and 12 deletions
|
|
@ -52,9 +52,6 @@ func (h *OnlyOfficeHandler) Callback(c *fiber.Ctx) error {
|
|||
// If the server cannot resolve the public URL due to hairpin NAT,
|
||||
// we can rewrite it to use the internal Docker IP
|
||||
downloadUrl := req.Url
|
||||
if strings.HasPrefix(downloadUrl, "https://office.elijahkuntz.com") {
|
||||
downloadUrl = strings.Replace(downloadUrl, "https://office.elijahkuntz.com", "http://192.168.50.81:8084", 1)
|
||||
}
|
||||
|
||||
// Download modified file from Document Server
|
||||
resp, err := http.Get(downloadUrl)
|
||||
|
|
|
|||
|
|
@ -45,16 +45,10 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit
|
|||
|
||||
const API_BASE = getApiBase();
|
||||
|
||||
// Use the internal backend URL for OnlyOffice server-to-server communication
|
||||
// to avoid Hairpin NAT/DNS issues from inside the Docker network.
|
||||
const INTERNAL_BACKEND_URL = 'http://192.168.50.57:5827';
|
||||
// Use the public API_BASE which correctly routes through the Nginx proxy to the Next.js frontend
|
||||
const fileUrl = `${API_BASE}/files/download/?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
|
||||
const callbackUrl = `${API_BASE}/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
|
||||
|
||||
// URL that OnlyOffice will use to download the file
|
||||
const fileUrl = `${INTERNAL_BACKEND_URL}/api/files/download/?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
|
||||
|
||||
// Callback URL that OnlyOffice will post to when saving
|
||||
const callbackUrl = `${INTERNAL_BACKEND_URL}/api/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
|
||||
|
||||
const baseConfig: any = {
|
||||
document: {
|
||||
fileType: file.name.split('.').pop() || 'docx',
|
||||
|
|
|
|||
Reference in a new issue