---
title: "Discussion on \"OpenAPI servers and server variables: local, staging, production, regions, and per-tenant hosts from one spec\" | Hashnode"
description: "Discussion on \"OpenAPI servers and server variables: local, staging, production, regions, and per-tenant hosts from one spec\". Hardcoding https://api.example.com means the same spec cannot drive a local mock, a staging test, and a production call. Define multiple servers, use server variables for regions and per-tenant subdomains, and set a relative server for serverless and same-origin docs. Here is how"
url: "https://hashnode.com/posts/openapi-servers-server-variables-multiple-environments/6aca076a6c2d4303c9d9540f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [OpenAPI servers and server variables: local, staging, production, regions, and per-tenant hosts from one spec](https://blogs.powerduck.com/openapi-servers-server-variables-multiple-environments?utm_source=hashnode&utm_medium=feed)

Hardcoding https://api.example.com means the same spec cannot drive a local mock, a staging test, and a production call. Define multiple servers, use server variables for regions and per-tenant subdomains, and set a relative server for serverless and same-origin docs. Here is how

Oct 8 · 6 min read · blogs.powerduck.com  
Read the article

-   [#openapi](https://hashnode.com/tag/openapi)
-   [#api-design](https://hashnode.com/tag/api-design)
-   [#environments](https://hashnode.com/tag/environments)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Powerduck](https://hashnode.com/@powerduck)

@powerduck · hon

  
[View profile](https://hashnode.com/@powerduck)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
