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.

Dev Server Proxy to HTTPS backend does not seem to work

See original GitHub issue

Do NOT ignore this template or your issue will have a very high chance to be closed without comment.

Describe the bug

Trying to proxy backend requests to a local server that is using HTTPS. Proxy configuration as follows:

module.exports = {
  proxy: {
    '/api': {
      target: 'https://localhost:8000/api',
      changeOrigin: true,
    }
  }
}

(Note that I have also tried various other variations without any improvements)

Requests fail to go through, appear to be attempting to proxy without HTTPS, i.e. to http://localhost:8000/api. End result is that the request fails with a 500 code, would expect it to query the server.

Reproduction

I think this is quite straightforward, but let me know if not.

System Info

  • required vite version: v1.0.0-beta.12
  • required Operating System: Windows 10
  • required Node version: 12.18.2
  • Optional:
    • npm/yarn version: 1.22.4
    • Installed vue version (from yarn.lock or package-lock.json): 3.0.0-beta.24
    • Installed @vue/compiler-sfc version: 3.0.0-beta.24

Logs (Optional if provided reproduction)

No error log, request simply fails in the browser.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
shysercommented, Sep 1, 2020

add secure: false, such as

export default {
  proxy: {
    // with options
    '/api': {
      target: 'http://jsonplaceholder.typicode.com',
      changeOrigin: true,
      secure: false
    }
  }
}
0reactions
tn-jedcommented, Oct 17, 2020

I’ve done some more testing on my end and it looks like the problem is with my backend service. When I swap in a different https backend, everything with the vite proxy works as expected. I’m using secure: false.

Thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack dev-server proxy over https - Stack Overflow
I'm using Vue and the webpack cli template. My back end is hosted in a docker container and can be seen at localhost:8443/foo....
Read more >
Webpack Dev Server ^3.9.0 unable to POST (send data to ...
A simple solution to fix this is to add append another configuration property to your dev server key named setup(). This will take...
Read more >
devServer proxy(in vue.config.js) not working - Get Help
I encountered this problem, too. devServer proxy not working What should i do? vue.config.js exists in root dir of vue project.
Read more >
HTTPS In Development: A Practical Guide - Marmelab
For the development environment, it seems trickier, but it isn't that ... On a development environment, we can use a reverse proxy, too!...
Read more >
Mastering Angular proxy configuration | by JM Robles - Medium
WTF can't access to my backend! Angular CLI provides a solution to bypass these problems: reverse proxy server. Enable the Angular Proxy. To...
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