|
Post by AMI_shirleyh on Nov 9, 2023 16:42:05 GMT
Hi,
Redfish Specification provides the 2 possible ways to handle URI's without trailing slash.
Is there any Rule how to handle the Redfish URI's ending with trailing slash or is it upto us to decide whether to
1. Redirect URI's with trailing slash to the URI's without trailing slash using 302 code
2. Ignore the trailing slash
For Eg : "https://{{ip}}/redfish/v1/Managers/BMC/" - Redirect to "https://{{ip}}/redfish/v1/Managers/BMC"
Thanks Shirley
|
|
|
Post by mraineri on Nov 9, 2023 19:08:58 GMT
It's really up to you; both options are valid and won't break clients that follow the spec exactly when it comes to URI rules and redirections. There is a 3rd option: you could return a 404 since a client really shouldn't be finding URIs that end in trailing slashes in the first place.
I personally prefer the "ignore" approach since it doesn't require performing another GET to the redirected URI, thus avoiding additional client churn. But make sure @odata.id in the response doesn't show the slash either.
|
|
|
Post by AMI_shirleyh on Nov 13, 2023 15:48:03 GMT
Thanks for your suggestions.
|
|
|
Post by AMI_ivywang on Jan 4, 2024 12:31:47 GMT
Hi, Refer to Redfish Specification DSP0266 Version 1.17.0 Table 5 — Redfish-defined URIs without trailing slashes Should the response be the same for "GET /redfish/" and "GET /redfish"? Thanks Ivy
|
|
|
Post by mraineri on Jan 4, 2024 14:01:03 GMT
Either the same response, or have /redfish/ redirect to /redfish.
|
|
|
Post by AMI_Jim on Jan 5, 2024 7:29:09 GMT
Either the same response, or have /redfish/ redirect to /redfish. Once user use POSTMAN but turn off the setting "Automatically follow redirects". If we turn on the setting, we will get the same result like /redfish, but when turn off we will get the result like below. We implement the redirect mechanism by set the response header Location and return code 302. Is the implement ok for the SPEC said that can "Redirect it to the associated Redfish-defined URI"?
|
|
|
Post by mraineri on Jan 5, 2024 13:23:32 GMT
That's all correct and conforms with the specification. If you disable redirection handling in Postman, you'll see the redirection response in the output. Browsers and other tools typically handle this under the covers and most users never see the original redirection response.
|
|
|
Post by AMI_Jim on Jan 8, 2024 2:58:22 GMT
That's all correct and conforms with the specification. If you disable redirection handling in Postman, you'll see the redirection response in the output. Browsers and other tools typically handle this under the covers and most users never see the original redirection response. OK, thanks for reply.
|
|