0

When I do a post to a backend service and get a 307 in my response, I'm doing a res.redirect('/'). Instead of doing that, can I redirect to a URL that belongs to a completely different site as well as post a form submit to that URL? I want to send values for SAML and RelayState. I currently have this login in my frontEnd by temporarily adding into the DOM a hidden form with two inputs. One for SAML and one for RelayState. Would it be possible to take that out of the frontend and have it done completely in the backend?

If i'm understanding this thread correctly, I'd like to do something like this but be able to dynamically fill in values for the inputs. The index.html example in this thread is essentially what i'm doing on the fly on my frontend: How to redirect to another page after serving a post request in Node.js?

EDIT:

Nevermind, I will do the submit on the frontend. When the other service returns a redirect, nothing will happen if I'm on my backend.

user6728767
  • 1,123
  • 3
  • 15
  • 31
  • You might need to clarify the question a bit, but looking at what you've asked, I wonder if you couldn't do something simple like `const myFunc = () => { doMyThing(); window.location = 'https://www.google.com'; } ` – alexandercannon Aug 29 '19 at 20:23
  • @alexandercannon I was thinking about it again, but is a `
    ` the same as me doing a post to that endpoint with axios or a similar client? Ex: axios.post(myUrl/route/route2) Then the values in the inputs are basically the requestBody in a normal http request right?
    – user6728767 Aug 29 '19 at 20:40

0 Answers0