Repository navigation
Keep the API key out of browser code in the SDXL Turbo web app tutorial - #986
Merged
Merged
Conversation
…stays out of the browser
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
lavanya-gunreddi
approved these changes
Nov 20, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open in Promptless
The "Integrate Serverless with a web application" tutorial put a Runpod API key in
script.js, which runs in the browser, and only warned about it after the code. Anyone who followed the tutorial and deployed the result would ship a key that can create, modify, and delete resources on their account to every visitor. This also contradicted the tutorial's own advice in step 2.This change reworks the tutorial so the key never reaches the browser:
script.jsposts{"prompt": ...}to/api/generateon the same origin and renders the returned base64 PNG. It has no API key, noapi.runpod.aiURL, and no authorization header.server.pyFlask backend serves the frontend, readsRUNPOD_ENDPOINT_IDandRUNPOD_API_KEYfrom environment variables, calls/runsync, and returns onlyoutput.images[0].image.flask --app server run --port 8000, and openshttp://localhost:8000. The "open the HTML file directly" option is removed, with a Note explaining that afile://page can't reach/api/generate.Fixes DOCS-557.
Verification: extracted the three files from the page and ran them.
node --checkpasses onscript.js. A Flask test client with a mocked Runpod API confirmed/api/generatesends{"input": {"prompt": ...}}tohttps://api.runpod.ai/v2/{ENDPOINT_ID}/runsyncwith the bearer header and returns{"image": ...}, returns 400 for an empty prompt, and serves/and/script.js.flask --app server run --port 8000starts and serves the page. The tooltip and redirect validation scripts pass. No live endpoint call was made.Trigger Events
Tip: Assign suggestions to team members in the Promptless dashboard to claim work 👥