Continuing the discussion from Programmable router:
I would like 301, 302, 307 and 308 too…
http://xp.readthedocs.io/en/stable/developer/ssjs/http-response.html?highlight=303
Continuing the discussion from Programmable router:
I would like 301, 302, 307 and 308 too…
http://xp.readthedocs.io/en/stable/developer/ssjs/http-response.html?highlight=303
It would be very nice if we could get permanent redirect, so that google removes outdated urls from their search results…
Are you sure writing 304 and setting the redirect parameter does not work? 303 should be the default value only I guess.
I have set status to many other things yes, and the browser get 303
What did you mean with “writing 304” status: 304 right?
"redirect": "/another/page",
is a shortcut for:
"status": 303,
"headers": {
"Location": "/another/page"
}
If you want to use another redirect status code (e.g. 301), just set this (and no redirect property)
"status": 301,
"headers": {
"Location": "/another/page"
}
Guess I “misread/skimmed through” the documentation again
http://xp.readthedocs.io/en/stable/developer/ssjs/http-response.html?highlight=redirect
Thanks for the help
But then again, your suggested approach does not work. Not even for 303.
These don’t seem to help either:
postProcess: false,
applyFilters: false
It looks like the status code cannot be overridden from the error.js script. Unless you set the "redirect"
property in the response. But that doesn’t allow other redirect status codes.
To summarise, you can set a different redirect status by setting status
and the Location
header in the response. But not from the error.js
script.
From error.js the status error code that was set can only be overridden by setting the redirect
property in the response.
This is fixed in 6.8.