mirror of
https://github.com/langchain-ai/langserve.git
synced 2026-07-18 10:54:29 -04:00
APIRouter(): GET /openai/playground HTTP/1.0" 307 Temporary Redirect #56
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lgertel on GitHub (Dec 1, 2023).
Originally assigned to: @eyurtsev on GitHub.
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.
@eyurtsev commented on GitHub (Dec 1, 2023):
Thanks for reporting -- probably a missing
/somewhere will take a look!@eyurtsev commented on GitHub (Dec 4, 2023):
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 :)
@dryprogrammer commented on GitHub (Jan 16, 2024):
Does it make sense to enable FastAPI strip_slashes=True rather than asking users to follow the README to the slash?