global-api-01.smartbotics.ai.conf 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # global-api-01.smartbotics.ai - the CUSTOMER-FACING hostname for
  2. # smartbotic-vectorapi. The old name (qdrant-1.shop.static.shopcall.ai, mount
  3. # /rag/) is unchanged and keeps working; this is an addition, not a move.
  4. #
  5. # It serves the API AND NOTHING ELSE. No docs page, no openapi.json, no
  6. # llms.txt, no admin web UI. Those were briefly whitelisted here and were
  7. # removed deliberately: customers do not need a self-service catalogue of
  8. # every route, and the docs page published the COMPLETE operation list -
  9. # admin-only key management, project deletion, the read-only lock and the
  10. # server-wide stats included - to anyone who loaded the URL. None of it was
  11. # callable without a key, but naming an endpoint is already a hint, and a
  12. # published list is also a published list of what to come back and try.
  13. # When an API is shared with a customer, send them the exact URL plus
  14. # minimal docs for the part they actually use.
  15. #
  16. # A WHITELIST, not a deny-list on `/`. The difference matters on the day a
  17. # later vectorapi release adds a route: with a whitelist it is absent here
  18. # until someone decides otherwise, with a deny-list it is exposed the moment
  19. # the package is upgraded, and nobody would notice. The cost is that a new
  20. # PUBLIC route has to be added here deliberately - which is the point.
  21. #
  22. # TLS is added by certbot --nginx against this block; the cert covers this name
  23. # only. Do NOT point it at the qdrant-1 certificate, which does not include
  24. # this hostname and would fail verification in every client.
  25. server {
  26. server_name global-api-01.smartbotics.ai;
  27. access_log /var/log/nginx/access.log timing;
  28. # Branded error pages for the errors nginx itself raises. See the snippet:
  29. # proxied responses keep their JSON envelope, which must not change.
  30. include /etc/nginx/snippets/branded-errors.conf;
  31. # The API itself. Authentication is vectorapi's: every /api/* path is
  32. # authenticated BEFORE routing, so an unknown path answers 401 rather than
  33. # 404 and nginx need not know the route table.
  34. location /api/ {
  35. proxy_pass http://127.0.0.1:8080;
  36. include /etc/nginx/snippets/vectorapi-proxy.conf;
  37. }
  38. # Liveness, kept so this hostname can be monitored from outside without a
  39. # credential. NOT under /api/, which is the trap worth knowing: a probe of
  40. # /api/v1/healthz answers 401 unauthenticated and 404 WITH a valid key,
  41. # because pre-routing auth runs before the route table. Verified it returns
  42. # {"status":"ok"} and nothing else - no version, nothing to disclose. That
  43. # is the whole reason it is still here while the docs are not.
  44. location = /healthz {
  45. proxy_pass http://127.0.0.1:8080;
  46. include /etc/nginx/snippets/vectorapi-proxy.conf;
  47. }
  48. # Everything else is absent on this hostname: the admin web UI, the docs
  49. # page and its asset, /openapi.json and /llms.txt. All of it stays
  50. # reachable on the old name under /rag/, which is where we read it.
  51. # 404 rather than 403: a 403 would confirm something is there.
  52. # Published HTTP functions, served to the world at /fn/{project}/*.
  53. #
  54. # Added 2026-10-22, deliberately AFTER vectorapi 0.16.0 was deployed and not
  55. # before. This route is unauthenticated BY DESIGN - a published function is
  56. # published - and until 0.16.0 it was also UNTHROTTLED, because the limiter
  57. # charge and `auth: 'key'` only landed in 0.15.0, which was never published.
  58. # Measured on prod before the upgrade: an anonymous POST with no credential
  59. # answered 200 in 0.106s. Adding this location then would have duplicated an
  60. # unbounded surface onto the one hostname kept narrow on purpose.
  61. #
  62. # It is defensible now because the function's `rate_limit_per_min` is charged
  63. # on the CALL as well as on its data access, and a descriptor may declare
  64. # `auth: 'key'` to require a key per caller - verified live: anonymous 401
  65. # against 200 with a key.
  66. #
  67. # NO trailing slash on proxy_pass, so /fn/... reaches vectorapi unchanged.
  68. # The /rag/ mount on the old hostname DOES strip its prefix; the two are
  69. # different on purpose. The shared snippet carries the timeouts and body
  70. # limit so this location cannot drift from /api/.
  71. location /fn/ {
  72. proxy_pass http://127.0.0.1:8080;
  73. include /etc/nginx/snippets/vectorapi-proxy.conf;
  74. }
  75. location / {
  76. return 404;
  77. }
  78. listen 443 ssl; # managed by Certbot
  79. ssl_certificate /etc/letsencrypt/live/global-api-01.smartbotics.ai/fullchain.pem; # managed by Certbot
  80. ssl_certificate_key /etc/letsencrypt/live/global-api-01.smartbotics.ai/privkey.pem; # managed by Certbot
  81. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  82. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  83. }
  84. server {
  85. if ($host = global-api-01.smartbotics.ai) {
  86. return 301 https://$host$request_uri;
  87. } # managed by Certbot
  88. server_name global-api-01.smartbotics.ai;
  89. listen 80;
  90. return 404; # managed by Certbot
  91. }