Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Swagger UI CORS error for GET redirection

My lambda api redirects url to another url. To document this on swagger UI. It gives CORS Error. this works fine with postman or from browser

Error message

TypeError: cross-origin to google.com denied by CORS policy. Origini null not allowd by Access-contrl-allow-origin

Note : I am using open api version version 2:0

my endpoint : https://my-domain/123456 -> redirects to google.com

serverless.yml

event:
 -http:
  path: / 
  method: ANY
  cors:true

app.js

 app.use(cors())

my swagger.yml

/{shortUrl}:
    get:
      tags:
        - 'Redirection'
      summary: 'Redirect short URL -> Original'
      description: 'This route redirects user to original URL website when a get is sent to trimified URL'
      produces:
        - 'text/plain; charset=utf-8'
      parameters:
        - name: 'shortUrl'
          in: 'path'
          description: 'ID of short URL'
          required: true
          type: 'string'
      responses:
        '400':
          description: 'Invalid URL'
          schema:
            $ref: '#/responseDefinitions/UserErrorResponse'
        '201':
          description: 'OK'
          schema:
            $ref: '#/responseDefinitions/ApiResponse'
        '500':
          description: 'Internal Server Error'
          schema:
            $ref: '#/responseDefinitions/ServerErrorResponse'
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!