Skip to content
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

if api domain is different from app domain then urls will be wrong #6272

Open
djay opened this issue Aug 28, 2024 · 1 comment
Open

if api domain is different from app domain then urls will be wrong #6272

djay opened this issue Aug 28, 2024 · 1 comment

Comments

@djay
Copy link
Member

djay commented Aug 28, 2024

Describe the bug

RESTApi currently assumes that all urls are on the same domain as the api endpoint and are treated as a local url if the url starts with the plone portal url. This applies to GET and POST. So if you have slate blocks with urls and save them, then these will only get turned into resolveUID links internally in the RESTAPI if the url matches the api url.

However Volto lets you have a different api url from the frontend url but it doesn't translate urls inside blocks into urls relative the portal root of the api url. Volto will pass the url as the full url based on the frontend url where the editing happens.

If you edit on a different url to the api url these links will be treated as external and the consequences are:

  • if the edit url is different to the frontend url the links will appear as the edit url and lead users to the wrong site
  • if the frontend url changes then the links will be broken
  • if the content moves then unneeded redirects will happen instead of direct links to the new location
  • deletion of linked content warnings won't occur
  • any other consequence of not having a resolveUID url.

To Reproduce

  1. serve your frontend on two domains
  2. make a slate link to another page
  3. view this on the via the other domain
  4. the url will take you to the edit domain

Expected behavior
This will be a local link

  • Volto should translate all urls to the api url before save. A reverse of the flattenToAppUrl translation.

  • Other solutions considered

    • RESTApi should accept relative urls and Volto should use those instead.
    • RESTApi has a list of url prefixes it should treat as internal

Screenshots
If applicable, add screenshots to help explain your problem.

Software (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Volto Version [e.g. 8.5.0]
  • Plone Version [e.g. 5.2.2]
  • Plone REST API Version [e.g. 7.0.1]

Additional context
Add any other context about the problem here.

@djay
Copy link
Member Author

djay commented Aug 28, 2024

tips on where the best place to patch this would be appreciated.

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

No branches or pull requests

1 participant