When Zuul routes a request to, say, login page, the static resources (css, js etc.) cannot be correctly located. A 404 Not Found error will be returned.
I have the following routing setting first:
ui:
path: /ui/**
url: http://serviceHost:8082/ui/
And it's working well. So when I visit http://zuulHost/ui/login/, I'll get an index.jsp and then the browser will request the static resources, whose paths are like:
/ui/ext/ext-dev.js
The browser will use http://zuulHost/ui/ext/ext-dev.js, for e.g, for that resource. And Zuul will route it to http://serviceHost:8082/ui/ext/ext-dev.js according to its setting.
But then I want to forward the request to the root / path to the login page, and I added:
root:
path: /
url: http://serviceHost:8082/ui/login/
This time, after the browser gets the index.jsp file, it will request the resources using:
http://zuulHost/ext/ext-dev.js
So in this case, the context /ui is lost, because the browser doesn't know about it since I'm forwarding the request in zuul internally. The url in the browser is still http://zuulHost. And zuul won't know where to route http://zuulHost/ext/ext-dev.js, since there's not a match in its routing table.
I wonder if there's a solution to it. I think it's a quite common issue when doing forwarding in proxy servers. Thanks.
Related
I've had an issue with Google Adsense not being able to access their config file (ads.txt) on my Rails site. I have put it in what I think is the correct folder (App -> Public).
In summary, this is the situation for which URLs work vs not:
[webURL].co.uk/ads.txt (works)
https://www.[webURL].co.uk/ads.txt (works)
http://www.[webURL].co.uk/ads.txt (works)
https://[webURL].co.uk/ads.txt (doesn't work - hangs)
http://[webURL].co.uk/ads.txt (doesn't work - error - HTTP Status: 404 (not found)
So my guess is that Google is trying to reach ads.txt via a URL without a www (the two bottom of the list above).
A couple of other points:
My Rails app is hosted on Heroku and I have a GoDaddy domain
On Godaddy, I have domain forwarding already setup, and so [mysite].com gets forwarded to www.[mysite].com.
So my question - how do I get URLs which don't have 'www' in them, to redirect to the equivalent URL with 'www'?
Any ideas?
Thanks in advance!
I resolved this by setting up Cloudflare and configuring some forwarding rules.
within my ingress file i have a path set up to navigate to my app, that routes to an application,
when i go to myingresIp/pss it redirects to myingresip/index.html, so it is almost like the routing is working its just not hitting my app.
I feel like the URL still needs to keep the /app prefix.
Can any one see what could be causing this problem or suggest a way of debugging this i am pretty new to AKS/kubernetes, or if there is some kind of logs that i can access to see what the underlying issue is?
Yaml:
The page i get then i navigate to myingresIp/pss is:
pod data:
Using the angular 2 debug server, I proxy requests to the real server using proxy.config.js. It seems that the ng2-signalr library does not respect the proxy configuration, and will attempt requests to whatever was defined as url in the IConnectionOptions used.
for the following request:
GET
localhost:4200/signalr/negotiate?clientProtocol=2.1&user=client&connectionData=%5B%7B%22name%22%3A%22compilationhub%22%7D%5D&_=1557816148076
the following error is produced:
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https
What would be the best course of action?
I got this working by adding the signalr route to proxy.config.js and setting the url property of my IConnectionOptions to location.origin. This setup bypasses the default route of /signalr so that a double forward slash route is not used.
I have created a very simple HttpModule that rewrites the incoming path to one that matches a route in MVC. ex.:
http://www.example.com/cars.html -> http://www.example.com/Home/Vehicles/3
To rewrite the path I simply use RewritePath on HttpContext.
The problem is that while it works in IIS Express, this doesn't seem to work in IIS. I can see that the URL is rewritten, but I get a 404. It seems to happen beacause instead of matching this rewritten route against the registered routes, the StaticFileHandler tries to handle the request.
So when http://www.example.com/cars.html is entered into the browser, on the IIS error page, I see the Requested URL:
http://www.example.com/Home/Vehicles/3
which is correct, but I will also see that it tries to load a physical path: X:\Project\Site\Home\Vehicles\3.
If I enter the rewritten path into the browser, the page is loaded and works as expected, so the routes are ok.
Any ideas how could I rewrite the path from my HttpModule so that the rewritten path is than matched against the registered routes in MVC? Or any ideas what could be missing? :)
Cheers
Adam
My images were all held in the app itself and so were referenced with /images/12345.jpg which in some places has been hard coded into the content of the cms, with or without the full url.
The images have now been moved to s3 and so I want to add a redirect for urls that are of the following formats:
/images/12345.jpg|png|gif
or
http://www.example.com/images/12345.jpg|png|gif
(but only for only numeric filenames)
and point them to
http://my.images.images.s3.amazonaws.com/540x310/12345.jpg|png|gif
I currently have
use Rack::Rewrite do
rewrite %r{images\/(\d*.)(jpe?g|png|gif)$}, 'http://my.images.images.s3.amazonaws.com/540x310/$1$2'
end
But this doesn't seem quite right.
UPDATE------
of course the URL in the source doesn't change, I should have realised that. Clicking the link directly returns an error:
No route matches [GET] "/http://my.images.images.s3.amazonaws.com/540x310/13135.jpeg"
(note the leading slash)
So the rewrite is working but it thinks it should be routing to an internal link not an external URL.
UPDATE2------
Changing to
r302 %r{(?:images\/)(\d*.jpe?g|png|gif)$}, "http://my.images.images.s3.amazonaws.com/540x310/$1"
will now redirect if I go to
http://www.example.com/images/13135.jpeg
but is not rendering the images in the site itself.
this was caused by the url on the localhost still pointing to the live url and therefore the 301 rewrite never being called.
So the local deployment had the live URL hardcoded into the page, i was then changing this and pointing my browser at localhost.
In the page though the old URL remained which meant the page was looking to the live server for a possible redirect which had never been dpeloyed