You can use this document to enable serverless scripting on an existing site and create a script.
Before you begin:
- To learn more about the concepts of severless scripting, see Serverless Scripting Overview.
- To test serverless scripting in a sandbox environment, see Serverless Scripting Sandbox Explained.
- To view sample scripts for common scenarios, see:
- Script example: Add headers to response
- Script example: IP Firewall
- Script Example: Multiple Origin Routing
- Script example: Response body modification
- Script example: Robots.txt response
- Script example: Static Response
- Script example: wp-login.php protection
- Serverless Scripting: Send Logs to Logging Services
Enable serverless scripting on an existing site and create a script
When you enable serverless scripting, this service will be applied to your entire stack. In other words, all sites within the same stack will have serverless scripting enabled; however, you will only be charged for the site where you specifically enable serverless scripting.
Each script will be restricted to the following limits:
- 5ms CPU Execution Time
- 15s Wall Time
- 128MB RAM
If you require more CPU/RAM for your script, please contact the StackPath Sales team.
- In the StackPath Control Portal, in the left-side navigation, click Sites.
- Locate and select the desired site. This action will refresh the portal.
- In the left-side navigation, click Scripts.
- Reviewing the pricing information, and then click Continue.
- Review the pop-up window, and then click Continue. You will be redirected to the Scripts screen.
- Click Add Script. You will be redirected to the code editor.
- In Script Name, enter a descriptive name for the script.
- In Route, enter the path that you can use to access the script.
- For example, if you enter demo-script, then to access the script, you would enter http(s)://yourdomain.com/demo-script.
- You can also test the script with your edge address.
- Update the script, and then click Create Script.
- Your script will deploy to the edge within seconds.