Request is sent to another URL, how to handle cookies for this redirection?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Request is sent to another URL, how to handle cookies for this redirection?
Hi,
using Soap UI 5.5 I have endpoint + resourse, but when sending the request, the RAW information shows totally different URL
As I see from the log, there is redirection and another URL needs cookie received from the first call. How to handle such requests? Now I've got http 403
Tested the same in Postman - request is sent correct and has http 200
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Afaik, SoapUI doesn't know how to handle cookies when there are multiple hosts involved. Another possibility would be to disable automatic redirects for this request and handle the cookies yourself (extract the set cookie value and then use it in the subsequent requests).
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, @Lucian!
How can I disable automatic redirects? I haven't found any setting for that. Thanks!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can click on the http request and then you'll have a little space with some settings on the bottom of the screen (see the picture below)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually that does not help because cookie is received somewehere during redirects 😞
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's why I proposed for you to disable the automatic redirects.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I've disabled it, but I do not know on which step I can get a cookie.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well that should be quite simple, isn't it?
You start by making the first request (the one for which the redirects were handled automatically). That request should either have a Set-Cookie header right away or just a redirect location (thus a Location header). If you're just getting a Location header then create a new request to that location (don't forget to disable the redirects for that request as well).
Next off, if your redirect request still doesn't have a Set-Cookie header, you might want to repeat the steps above, so take the Location header again, create a new request etc. You might encounter multiple redirects until you finish off landing on some page.
Let me know how it goes for you 😄
