-
Notifications
You must be signed in to change notification settings - Fork 87
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
How to forward to a absolute PATH? because thenForwardTo() only accepts host url without PATH. #153
Comments
Hi @pimterry , please let me know if it is possible? |
Hi @rivudutta. If you want to do this, you'll need to do so with a |
@pimterry thanks for the solution, I have tried this but it also changes the URL with the targetURL in the chrome address bar. For example,
|
If the addressbar is being changed, that means the way you're rewriting the request is making github return a redirect response (e.g. a 301/302/307 status) for some reason. You'll probably be able to see that in the network inspector in the browser. It's hard to know exactly why that might happen I'm afraid, I'd recommend testing out different requests and rewritings manually and see if you can tell what's causing that. As far as I'm aware though, returning a URL there should do almost exactly the same as using The code for each is here:
To debug this further, you might want to try logging the received & forwarded requests using |
Thank you for the debugging steps, I will try them. |
I want to forward requests to a particular path but I am not able to do it using thenForwardTo(). It is throwing error and it only accepts hostname (without path).
For example, I want to match one absolute URL & forward it to another absolute URL.
// Redirect any github/login requests to github.com/signup
server.anyRequest().forHost("https://github.com/login").thenForwardTo("https://github.com/signup");
The text was updated successfully, but these errors were encountered: