Saturday 8 April 2017

Koajs routes work with HTTP but broken with HTTPS

I'm setting up HTTPS on my koa2 API with letsencrypt, using the last part of this DigitalOcean guide. I'm using nginx for reverse proxy. Everything works fine with HTTP but with HTTPS my routes are broken, and since this is my first time setting up HTTPS, I'm having a hard time finding the cause. For example, with plain HTTP, making a request to http://myapi.com/api/some-route, I'd see a request looking something like

{ 
  request: { 
  method: 'GET', 
  url: '/api/some-route', 
  header: { 
    'origin': 'https://myapi.com', 
    accept: '*/*' 
  } 
}

With HTTPS it looks like

{ 
  request: { 
  method: 'GET', 
  url: '//some-route', 
  header: {accept: '*/*' } 
} 

The request.url is funky and the origin header is missing. I'm wondering if it's an issue with my nginx config, but having a hard time figuring out where to start.



via harumphfrog

No comments:

Post a Comment