make swagger api calls use https?

1,056 views
Skip to first unread message

Dustin Cannon

unread,
Mar 28, 2019, 4:41:29 PM3/28/19
to NetBox
Sorry if this has already been asked but I can't find an answer searching through the existing threads. The swagger ui under /api/docs/ seems to want to do all api calls via http. Is there a way to make swagger use https for those calls instead? Thanks!

Dustin Cannon

unread,
Mar 28, 2019, 4:59:46 PM3/28/19
to NetBox
Ah so, it seems swagger will set the scheme to whatever scheme the initial request is using. so if you hit http it sets it to http and if you hit https it sets it to https. in my case the ui is available through a reverse proxy that hits netbox on port 80. but you can hit /api and only /api directly via https. so when i'm coming at swagger through the proxy all the urls are http. but if i directly hit netbox via https (not through the proxy) then swagger urls are http. probably can get it working the way i want with some nginx changes.

Brian Candler

unread,
Mar 28, 2019, 5:37:26 PM3/28/19
to NetBox
Yes, get the proxy to add header

X-Forwarded-Proto: https

when the inbound request is https.
Reply all
Reply to author
Forward
0 new messages