question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to enable https scheme for urls?

See original GitHub issue

Hello, i`m trying to go from drf_yasg to drf-spectacular and i have a question: Is there a way to enable https for your urls, in drf_yash it was done like this:

class APISchemeGenerator(SchemaGenerator):
    def get_schema(self, request=None, public=False):
        if not request:
            print("NET")
        try:
            schema = super().get_schema(request, public)
        except Exception as e:
            print(e)
            return e
        schema.schemes = ['http', 'https'] # this allows me to use http and https for my requests
        if not LOCAL:
            schema.base_path = '/api/'
        return schema

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MrMika96commented, Nov 7, 2022

Hello again, i was able to do what i needed with protocols. The documentation says that if your servers variable in empty ‘url’ will be set to ‘/’ by default, so i just added variables and scheme selector appeared.

'SERVERS': [{'url': '{protocol}:/', 'variables': {'protocol': {'enum': ['http', 'https'], 'default': 'https'}}}]

image

0reactions
MrMika96commented, Nov 3, 2022

Ok, thank you for answers, i will try to come up with something for that case

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling HTTPS on your servers - web.dev
Steps covered in this article · Enable HTTPS on your servers · Make intrasite URLs relative · Redirect HTTP to HTTPS ...
Read more >
Enabling HTTP Secure (HTTPS)
On Drupal 7, if you want to support mixed-mode HTTPS and HTTP sessions, open up sites/default/settings.php and add $conf['https'] = TRUE; .
Read more >
Defining a custom URL scheme for your app
URL scheme registration specifies which URLs to redirect to your app. Register your scheme in Xcode from the Info tab of your project...
Read more >
How to Enable HTTPS Tracking Links
Mailgun supports enabling the HTTPS protocol on open, click and unsubscribe tracking URLs. Mailgun utilizes Let's Encrypt with HTTP-01 challenges via your ...
Read more >
URL Scheme Rewriting, from HTTP to HTTPS, for Specific ...
Adding abc.xyz.com to the browser's HSTS preloaded list seems like the best way to do this, but that can only by initiated and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found