Code Monkey home page Code Monkey logo

Comments (8)

kataras avatar kataras commented on May 14, 2024 1

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.

kataras avatar kataras commented on May 14, 2024

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.

yunhor avatar yunhor commented on May 14, 2024

2017-08-13 01-28-41

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.

yunhor avatar yunhor commented on May 14, 2024

Thank you @kataras ,I will try SPA method.

from iris.

kataras avatar kataras commented on May 14, 2024

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.

jolee11 avatar jolee11 commented on May 14, 2024

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"

screen shot 2018-11-26 at 10 55 37 am

from iris.

kataras avatar kataras commented on May 14, 2024

@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,

  1. 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).
  2. to fix that you could pass iris.WithoutPathCorrection option to iris.Run(iris.Addr(...), iris.WithoutPathCorrection) however I will refactor the code a bit in order to fix this, stay tuned.

from iris.

jolee11 avatar jolee11 commented on May 14, 2024

Thank you very much!

from iris.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.