Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With proxy enabled, websocket requests in network tab every second #497

Open
freiguy1 opened this issue Sep 16, 2020 · 1 comment
Open

Comments

@freiguy1
Copy link

Hello. I have a question about these piling up in my development console (this is in firefox). A new couple of rows gets added every second:

image

I've added a proxy for my server application at port 3030. That server does have a wildcard endpoint for any route not recognized to send back build/index.html because routing is to be done within the Elm application.

The proxy definitely works, I can get json bodies from my GET endpoints from my server app.

I attempted to create a manual proxy which would only forward '/api' requests and that seemed to work, but that feels dirty since now I have packages.config, lock file and packages_json folder. Also the project requires more setup (npm install) for all developers and in the Dockerfile. I'd rather just stick with elm-app start.

Any ideas how to resolve this spamming? Hot reloading is working at the moment, which I wouldn't expect because I think that's the job of these websocket requests.

@freiguy1
Copy link
Author

freiguy1 commented Sep 17, 2020

I think I've solved this in an unconventional way. I use elmapp.config.js's setupProxy in a way it wasn't meant to.

module.exports = {
    setupProxy: (app, server) => {
        this.proxy = [{
            context: ['/api'],
            target: 'http://localhost:3030'
        }];
    }
}

I'm going to go with that for now, but leave it the issue open.

EDIT: formatting

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

No branches or pull requests

1 participant