-
Notifications
You must be signed in to change notification settings - Fork 169
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
Passthrough not working for cross-origin requests #367
Comments
You can pass through all requests for a single domain like this this.passthrough('http://api.amazon.com/**') but unfortunately you can't wildcard all domains. But, this.passthrough(request => {
return request.url.match(/regex/)
}) Let me know if that helps! Here are the full passthrough guides. I know this is a confusing API today, we have plans to improve it so you can passthrough anything that is not defined, and that's very high priority behind some other stuff we're working on now. |
@samselikoff do you know a way forward on this? If I'm not mistaken there is a rather cumbersome inconsistency: if you define a Is there any way we could resolve this? Maybe only evaluate and apply |
Hm. I agree that is inconsistent + unfortunate behavior. Could you use a Our goal here is to eventually add a this.passthrough(request => {
return !server.canHandle(request)
}) In other words, pass through every request the server doesn't have a defined route handler for. |
Wouldn't |
No, it would use route recognizer to see if a runtime request to a URL like |
We started work for it here: #320 We paused work on it because we needed to focus on the tutorial + existing bugs. |
I'm sorry for sounding like a broken record (just want to make sure I understand fully), but isn't that precisely what
|
No worries, the questions don't bother me! I haven't looked at this code in a while and am just trying to answer questions at a higher level to explain our plans, so I could be wrong. But I think In our case we want a method Then Mirage's |
Hi @rassie
I think this seems reasonable, but I'm having a hard time visualizing a config that highlights this change. Could you share your server's routes and examples of requests you'd like mirage to handle vs passthrough. That'll help! I think getting a test case of sorts in place is the best way to see what's going on. |
Hi,
I am setting up my routes like so:
This only passes through requests made on same origin but does nothing for the other cross-origin requests. Is this an expected behaviour? If yes, how can we achieve pass-through behaviour for all remaining request except for the one mentioned explicitly in the routes?
The text was updated successfully, but these errors were encountered: