-
Notifications
You must be signed in to change notification settings - Fork 25
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
Generate correct redirect URL when using TRUSTED_HOST #91
Comments
@alexandersch Thx for creating the issue. I think here was something misscommunicated in the slack channel. The frontend application or the server rendered node js application need todo the following in this case e.g.:
So at current state from the backend handling here is correctly, but we need really make aware what all is needed to implement a correct router in your application handling redirects from the sulu backend correctly. As example the I hope I could make the problem more understandable that a redirect follow is here the problem in the frontend application and not the route which responded in the |
@alexandersch we did also have some discussion here that we could create maybe a optional activateable {
"type": "redirect",
"redirectType": "external", // or internal
"url": "http://google.com/..",
} But need to invest here some more time. |
Thanks for creating this issue! It looks like it is quite hard to configure I think this is somehow related to returning the data for |
Ah, too bad fetch does not support this... +1 for a redirect JSON response consistent to internal link page. I think this would make it a lot easier to implement a redirect in frontend application. |
If I remember correctly the projects where we used server side rendering over a JS framework are now setting the |
When having set the
TRUSTED_PROXIES
andTRUSTED_HOSTS
, generated URLs will use the URL provided by theX-FORWARDED-HOST
header when fetching a page through the API (e.g. in a `text_editor' content type this will replace the absolute URLs with the provided URL in the header).A page that has been configured as an internal link will generate a redirect when fetching the page through API. This is all correct behaviour.
The problem is that the generated redirect URL is then also using the forwarded host header. I think this should be the Sulu URL and not the provided URL by the forwarded host header.
Consequence is that the frontend follows redirects and fetches the wrong (redirected) URL, thus no JSON content from Sulu.
Please let me know if more info or examples are needed.
The text was updated successfully, but these errors were encountered: