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

Proxy not working if Browser.application is used #601

Open
ad-si opened this issue Oct 2, 2021 · 1 comment
Open

Proxy not working if Browser.application is used #601

ad-si opened this issue Oct 2, 2021 · 1 comment

Comments

@ad-si
Copy link

ad-si commented Oct 2, 2021

Is this a bug report?

Yes

Environment

  1. node -v: v16.10.0
  2. npm -v: 7.24.1
  3. npm ls create-elm-app -g:
    /usr/local/lib
    └── create-elm-app@5.22.0

Then, specify:

  1. Operating system: macOS Catalina 10.15.7 19H1419 x86_64

Steps to Reproduce

  1. Start a JSON API server at http://localhost:8081 serving an /items endpoint
  2. Add this to elmapp.config.js
    module.exports = {
      proxy: "http://localhost:8081",
    }
  3. Create Elm app like:
    main : Program () Model Msg
    main =
        Browser.application
            { view = view
            , init = \_ -> \_ -> \_ -> init
            , update = update
            , subscriptions = always Sub.none
            , onUrlRequest = \_ -> NoOp
            , onUrlChange = \_ -> NoOp
            }
  4. Start elm app with npx elm-app start

Expected Behavior

http://localhost:3000/items should serve the JSON

Actual Behavior

Serves the same Elm app as under http://localhost:3000


I assume that the problem is the interaction with Browser.application, but I'm not sure about that.

@ad-si
Copy link
Author

ad-si commented Oct 2, 2021

So the proxy is actually working, but you can't open it in the browser! 😅
Because of the requested Content-Type I guess?

I leave this issue open as "Improve documentation on how proxy is working exactly"

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