Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

CSP error when hot-reloading in sub-pages #858

Open
mittalyashu opened this issue Apr 21, 2019 · 1 comment
Open

CSP error when hot-reloading in sub-pages #858

mittalyashu opened this issue Apr 21, 2019 · 1 comment

Comments

@mittalyashu
Copy link

Found an issue or bug with electron-vue? Tell me all about it!

On the homepage (a.k.a / route), when the app hot-reload there is no problem with the application it works perfectly fine, but when we move to sub-pages /repository/workspace and then try to make some changes to the code, the electron app shows a blank screen.

Describe the issue / bug.

It looks like the problem is in electron configuration, but it's not, instead, the problem is in the .electron-vue where the configuration of webpack exists.

I think when it reloads the page when the is in sub-routes, for some reason, it forgets the URL (or something similar)

How can I reproduce this problem?
  • Create and move to a sub-routes
  • Make some changes to any file
  • Open the electron app and see the error
If visual, provide a screenshot.

image

Tell me about your development environment.
  • Node version: v11.10.1
  • NPM version: v6.7.0
  • vue-cli version: (if necessary) 3.1.3
  • Operating System: Windows 10

Could be related to #437

@JBtje
Copy link

JBtje commented May 17, 2019

My assumption is that the below code might be helpful. I placed it in:

src/main/index.js

function createWindow() {

   ...

    session.defaultSession.webRequest.onHeadersReceived( ( details, callback ) => {
        callback( {
            responseHeaders: {
                ...details.responseHeaders,
                'Content-Security-Policy': 'script-src \'self\' https://URL-TO-SITE.com',
            },
        } );
    } );
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants