Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda