ariadne icon indicating copy to clipboard operation
ariadne copied to clipboard

`https://<api_host>/graphql` results in 307 redirect to `http`

Open liqwid opened this issue 2 years ago • 1 comments

Context

When using https://<api_host>/graphql endpoint instead of https://<api_host>/graphql/ Ariadne sends a 307 redirect to the trailing-slash one.

Expected behavior

Initial scheme (http or https) should be respected in the redirect

Actual behavior

You get always redirected to http which in turn results in browser Mixed Content error (e.g. in Chrome 105.0.5195.125+)

liqwid avatar Sep 20 '22 09:09 liqwid

Ariadne is not implementing any router that would check the URL and make such redirect. Are you mounting it under FastAPI or Starlette?

rafalp avatar Sep 20 '22 09:09 rafalp

Mounting under FastAPI, sorry for the delay

liqwid avatar Oct 07 '22 04:10 liqwid

This is behaviour of Starlette's router that FastAPI also uses. Your usecase is even explicitly mentioned here:

https://github.com/encode/starlette/issues/869

rafalp avatar Oct 07 '22 17:10 rafalp