Closed lgertel closed 8 months ago
Thanks for reporting -- probably a missing /
somewhere will take a look!
Hi @lgertel, I hope I'm not missing something deeper here -- the correct URL for the playground is expected to have e trailing /
. If you enter a URL without a trailing /
, fastapi automatically does a redirect and to a URL that does include a trailing /
.
I updated the README in a few places to make sure endpoints have trailing slashes: https://github.com/langchain-ai/langserve/pull/282
I'll close the issue for now, but feel free to re-open if you think I misunderstood it :)
Does it make sense to enable FastAPI strip_slashes=True rather than asking users to follow the README to the slash?
I'm getting this issue with bigger applications that use APIRouter.
llm_router = APIRouter() add_routes(llm_router, ChatOpenAI(), path="/openai") add_routes(llm_router, GooglePalm(), path="/palm2")
` app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=[""], allow_credentials=True, allow_methods=[""], allow_headers=["*"], )
`
The weird thing is that it works if I add the / after the path on the browser.