Comments (8)
Done, upgrade with go get -u github.com/kataras/iris
and you're ready to go :)
@yunhor Thank you very much for your report, it lead me to fix an important issue we had in my mind for a long time.
Please star or watch the repository to receive real-time updates.
from iris.
Hello @yunhor
Could you please provide us a code-snippet that produces this type of result?
Update:
StaticWeb
does not recognize http://localhost:8080/static/
as http://localhost:8080/static/index.html
but this is not its fault, it's router's fault.
We have the app.SPA
function which will do the job for you (derives from Single Page Application, was introduced in V8)
If you're serving the whole website from static assets (i.e view managed by react,angular...) use app.SPA
instead, it's faster and is designed for that reason.
assetHandler := app.StaticHandler("./static", false, false)
app.SPA(assetHandler)
Examples can be found here: https://github.com/kataras/iris/tree/master/_examples/file-server/single-page-application
Update 2:
However I did some digging to a relative situation and I found a minor issue.
Update 3:
I found the origin of the (Update2) issue and I've fixed that but I have no time to test it much more right now, I'm in the office. I want to be 100% sure that we will not face an issue like that on the near future and I'll push the fix to the repository when I go back to my house. Wait for that fix, which solves the issue of StaticWeb
you described on this thread.
Thank you,
Gerasimos Maropoulos
Please follow the project to learn about its new features, I am pushing a history entry on every single change, this way you will not have to post an issue every time.
from iris.
I map ./go to /go ,when ./go/go.htm change name to "index.html" ,It can't work on v8.2.4
":6300/go/index.html" neither
from iris.
Thank you @kataras ,I will try SPA method.
from iris.
I found the origin of the issue and I've fixed that but I have no time to test it much more right now, I'm in the office. I want to be 100% sure that we will not face an issue like that on the near future and I'll push the fix to the repository when I go back to my house. Wait for that fix, which solves the issue of StaticWeb you described on this thread.
from iris.
I just run iris-master/_examples/file-server/basic/main.go
All the following gives "Not Found"
http://localhost:8080/static
http://localhost:8080/static/
http://localhost:8080/static/index.html
If I rename index.html to i.html, then
http://localhost:8080/static/i.html gives "Hello index"
from iris.
@jolee11 this happens because /static/ redirects to /static and index.html is not part of the /static but /static/index.html. The /static/ or /static/index.html will redirect to /static and that was expected as go docs of the StaticWeb
.
So you have two options,
- Register a handler for your
/static
to serve the index.html (this can give you control whether the user asked assets or a particular index page). - to fix that you could pass
iris.WithoutPathCorrection
option toiris.Run(iris.Addr(...), iris.WithoutPathCorrection)
however I will refactor the code a bit in order to fix this, stay tuned.
from iris.
Thank you very much!
from iris.
Related Issues (20)
- [BUG] The cache entry has not been truly deleted after expiration HOT 5
- [BUG] Pluralization uses yml for template configuration, uses ctx.Tr method for rendering, returns no data HOT 1
- [BUG] HOT 3
- [BUG] may be an out-of-boundary bug as a result of lack of necessary argument checks HOT 1
- [BUG] Process hang HOT 1
- [FEATURE REQUEST] redis sentinel support
- [FEATURE REQUEST] Support log/slog HOT 4
- [QUESTION] iris v12.2.0 app.ContextPool.Attach not found HOT 1
- [HELP] How to dynamically start http services on multiple ports? HOT 1
- [HELP] How to proactively send websocket messages to the client in an MVC structure?
- [HELP] Multiple event when using native message
- Iris gRPC wrapper breaking HOT 1
- getBuiltinFuncs problem
- [BUG] template part Unable to load HOT 1
- [BUG] I used goroutine to affect the later HTTP before the service startup HOT 2
- [BUG] validation of binding is not effective
- [QUESTION] The session configuration provided by the iris framework is limited
- [FEATURE REQUEST] Get the data in the session through the session id
- [BUG] ctx.RemoveCookie need more special attribute(`domain` and `path`) value to remove cookies HOT 3
- slog is not in GOROOT HOT 1
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 iris.