Skip to content

Commit b43448f

Browse files
committed
Respond to /api/v1/environment-document with 400
1 parent fc8534b commit b43448f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/edge_proxy/server.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import http
12
from datetime import datetime, timedelta
23

34
import httpx
@@ -85,13 +86,26 @@ async def flags(feature: str = None, x_environment_key: str = Header(None)):
8586

8687
@app.post("/api/v1/identities/", response_class=ORJSONResponse)
8788
async def identity(
88-
input_data: IdentityWithTraits,
89-
x_environment_key: str = Header(None),
89+
input_data: IdentityWithTraits,
90+
x_environment_key: str = Header(None),
9091
):
9192
data = environment_service.get_identity_response_data(input_data, x_environment_key)
9293
return ORJSONResponse(data)
9394

9495

96+
@app.get("/api/v1/environment-document/")
97+
def environment_document():
98+
return ORJSONResponse(
99+
status_code=http.HTTPStatus.BAD_REQUEST,
100+
content={
101+
"message": "The Edge Proxy does not serve environment documents and cannot be consumed using local "
102+
"evaluation. Make sure your Flagsmith client application is consuming the Edge Proxy using "
103+
"remote evaluation, i.e. using a client-side environment key and with local evaluation "
104+
"disabled. See https://docs.flagsmith.com/clients/"
105+
}
106+
)
107+
108+
95109
@app.on_event("startup")
96110
@repeat_every(
97111
seconds=settings.api_poll_frequency_seconds,

0 commit comments

Comments
 (0)