Comments (7)
Ahh missed that, sorry
from elm-live.
No problem! Glad to hear you're up & running. 👋
from elm-live.
This is correct. The browser makes a request to http://localhost:8000/api/v1/measurements
, served by elm-live
. Then under the hood the elm-live
server will proxy the request to http://localhost:8443/api/v1/measurements
.
from elm-live.
Ah, I understand.
But I still have a problem: The requests it sends return 404.
For example I see in the Network tab GET http://localhost:8000/api/v1/measurements
that resulted in 404.
But if I run curl http://localhost:8443/api/v1/measurements
, it is successful.
from elm-live.
It looks like proxy prefix is deleted from URL: https://github.com/wking-io/elm-live/blob/master/lib/src/start.js#L187
i.e. http://localhost:8000/api/v1/measurements
would be proxied to http://localhost:8443/v1/measurements
with --proxy-prefix '/api'
from elm-live.
Huh, that makes little sense. Thanks for figuring that out.
Now I'm unsure how I can achieve what I want:
I want to locally run the app with elm-live
and proxy all requests to an API running on a different port.
In production, I want the same Elm code to send a request to the path part of URL: /api/v1/
, so if it's running on example.com
and sends a request to /api/v1/something
, it gets sent to example.com/api/v1/something
from elm-live.
@Ploppz Add /api
to the proxy-host as well, like so:
elm-live src/Main.elm --proxy-prefix '/api' --proxy-host 'http://localhost:8443/api' -- --output elm.js
See https://www.elm-live.com/#getting-started and scroll down to documentation for --proxy-prefix
:
NOTE: The string passed to
--proxy-prefix
will be removed from the--proxy-host
url. If you would like the url to include the prefix just add it there as well like: http://localhost:5000/api
from elm-live.
Related Issues (20)
- [QUESTION] Plans for tests
- elm-live crash when a file is not found instead responding with a 404 HOT 4
- Support multiple proxies
- Option to ignore self signed certificates in proxied services
- elm-live adds "undefined" text to the document HOT 4
- Reload snippet not inserted when using --proxy-host HOT 1
- file watcher does not work on mounted docker volumes HOT 2
- Request for Release that bumps `http-proxy` to >=1.18.1 HOT 4
- Not refreshing when specifying Elm file in folder. Only watches /src folder for changes. HOT 1
- "-- --output=elm.js" not working as expected in PowerShell HOT 1
- Only certain known filetypes are served
- Yarn: Output In Wrong Location when using -- --output='file.js' HOT 2
- Support multiple elm apps (mains)
- Saving the same file over and over again quickly causes problems HOT 2
- anchors seem broken in documentation
- elm-live renders empty page, elm reactor renders correctly HOT 1
- Hot-reload mode completely blank HOT 1
- Serving .js files as HTML leading to a blank page HOT 2
- reload code not served through nginx reverse proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elm-live.