-
Notifications
You must be signed in to change notification settings - Fork 27
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
changing /graphql location #6
Comments
Hi @srini85, Thanks for raising this, I'll have to take a look to confirm then get back to you. |
@srini85 it seems ok when running the example project. what was your plan with this? i'm not sure how best to templatize the html, since it's just an embedded file |
@simonpetty want to use an alternative location to /graphql. I was thinking of doing it at build time by setting it in the configuration json and then using that as part of the build process. However I couldn't get the project working when I built it myself. So hence wondering if the nuget version is different to the the master src. |
Another option would be to use the .NET Core proxy library to capture requests to a custom endpoint and proxy them to /graphql. @srini85 Were you working from a fresh clone of master? I've just did a hard reset ( How are you launching it? |
@srini85 I've just tried launching Graphiql from a custom location ( |
@josephwoodward I will see if I get time to push that repository I was working with. Maybe I am missing something, but deffinately did work of a fresh clone of master with no changes. But if you are confirming that it deffinately does work, perhaps I am missing some step or my environment is not quite right. I will continue to dig and let you know the result. Just out of curiousity, when you said it worked, are you referring to graphiql loading or loading and making requests to the server? Seeing that the fetch promise is set to |
The graphiql page loads but the post when submitting a query doesn't work. Another idea is to use an InMemoryFileProvider for the JavaScript currently in the html page, which we can modify with the correct path. Will try to get a version of this going. |
@simonpetty Weird, I'm sure I tried posting a query, I'll take another look and check it out. I think there are a few options we could use to get that working, such as the proxy which I mentioned above. |
This does not work when hosting under IIS virtual directory. For me a path relative to graphiql would solve the issue... |
I also am trying to change the routes to |
Yeah, this seems to be the biggest blocker. I'm considering adding a template string to the return fetch('{{ graphqlPath }}', { Seems like the easiest option. |
@josephwoodward That should work. Do you think we would have a release anytime soon? |
@pouladpld Hopefully either this week or next by the latest. |
Can't wait 😄 I'll try making a PR. |
Hello. Could we please get this issue addressed? We are facing the same issue, as Graphql is part of a versioned solution (so it runs as my.service.com/1.0/graphql). Actually simply removing the path from here https://github.com/JosephWoodward/graphiql-dotnet/blob/master/src/graphiql/assets/index.html#L112 should do the trick as it then makes a request to the resource itself. That should satisfy all cases, regardless if you are hosting under a completely custom URL or "just" in a subdirectory like we are. |
Have an open PR for this (#23) which I'm currently testing an will release in the next few days. |
This has now been released as a beta package, if you would mind giving it a try and reporting back if you find any issues. You can find the beta here. I'd like to give a special thanks for @pouladpld for his pull request to get the ball rolling on this. |
Hi! We are currently testing this. While this change allows us to explicitly set our path (eg. Cheers |
Actually, digging deeper, the real problem is that GraphiQL treats the server and JS paths the same. If you have a setup in IIS like this ... |
Thanks for giving the beta try!
I don't have IIS to hand as I use a Mac/Linux, any thoughts how we could resolve this? Not sure how we could get around IIS stripping values from the path, feels like that shouldn't be the responsibility of this library. Thoughts? |
Yes, I am absolutely with you, it's not your responsibility to know that. Obvious "worst case" solution is allowing setting of JS and C# paths separately, but that really isn't elegant. |
@FrankyBoy Though I'm wondering if there would be any use cases for adding an overload to enable you to configure the JS and C# paths separately. I'm not completely against the idea. |
Other than my use case (i.e. IIS being weird) I see also this one: Having a separate configuration would make sense if someone wants to host the UI in a different location than the actual graphql endpoint. Like Not sure if anyone would ever want to do that, it's just another potential use case I see. |
Any update here? Should I just push a change that lets us configure server and client path independently or can you look into the topic? Cheers! |
1.2.0 has now been published to NuGet, I will now close this PR. If anyone has any issues then please feel free to reopen it. |
@areyes21 That's odd. If you perform the query via a raw HTTP Request (as opposed to using GraphiQL), do you get any results? That would isolate the issue to this library. Also, have you looked in your browser's dev tools? GraphiQL queries your API via an ajax request so it would seem that your API is returning no data? Is the schema viewer working? |
Is there any chance you'd be able to create a repo of this issue as I'm struggling to reproduce it? Alternatively, what does your configuration look like? I see you're running it from localhost in your screenshots? Earlier you mentioned it was only when you published your app to IIS? (or does it also do it if you're running it via IIS locally?) |
Sorry I do not speak English but I will do my best to explain |
Thanks for all the help, Greetings from Nicaragua |
I'm glad you got this sorted in the end, I'm going to mark this issue as closed. |
Looks like this is not quite working as its supposed to. My understanding is that we need to change the js file aswell if we specify an alternate location
in index.html
Wanted to see if I could fix it but ran into issues when I tried to reference the source as a project reference.
I pulled the source and did a build, when I referenced the project, I couldn't get the graphiql page to load. The /graphql endpoint was just not serving up the static pages.. Not too sure why. The dll in nuget definitely works so wondering if that is a different version to what is in master?
The text was updated successfully, but these errors were encountered: