Odoo: URL not found if not auth - odoo-9

I have controller with route:
#http.route(['/report/yandex_phone_report'], type='http', auth="public", website=True)
def yandex_phone_report(self, **kw):
page_data = []
return http.request.render(self._report_index_page_template, {
'page_items': page_data
If I logged in URL /report/yandex_phone_report displayed fine.
If I not loged in URL /report/yandex_phone_report is returning 404:
2017-08-02 16:46:09,400 5942 INFO ? werkzeug: 127.0.0.1 - - [02/Aug/2017 16:46:09] "GET /report/yandex_phone_report HTTP/1.1" 404 -
Browser is displaying this:
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
How can I fix it? Why route is not working?

It happens because it doesn't know on which database to look for that URL.
If you look on the log you provided, you will see that after INFO, you have ?
2017-08-02 16:46:09,400 5942 INFO ? <- THIS ONE
Instead of ?, you see a database name, if it knows which database it should use.
To test it, you can first call: http://localhost:PORT/web?db=YOUR_DB_NAME
This will setup the session on the browser for the given database.
Then, calling http://localhost:PORT/report/yandex_phone_report will work.
On a production environment, you will need to configure it to get the database name from somewhere... From the URL, for instance (http://dbname.example.com:PORT).

With multi-db environment you can have auth='none' but also your module needs to be added to odoo.conf server_wide_modules
This way the route will be added. At least in Odoo 13.
https://odoo-development.readthedocs.io/en/latest/admin/server_wide_modules.html

Related

How to stop the GET method is not supported for this route from showing?

I have a working Laravel project with loads of different routes.
I'm currently testing it and one of my tests was to check if a user were to use a delete or post route from the URL. I didn't know what the application would do honestly and it outputted the typical:
The GET method is not supported for this route. Supported methods: DELETE
which I have seen a million times. Is there a way to stop this error from coming up and instead output an error screen or simply redirect to a different view?
The error message:
The GET method is not supported for this route. Supported methods: DELETE.
should only appear when your Laravel site has APP_DEBUG set to true (in the .env file).
When APP_DEBUG is set to false as it should always be in on a live site, then the user will be shown a 404 error page instead.
You can easily test this by adding the following code to your routes file:
Route::delete('test', function() {
return 'You should never see this text when viewing url via a GET request';
});
May be u didn't noticed but ur form tag method attribute and route definition is different

My post route doesn't work, postman thinks it is GET request

I have my resource Route, it works fine for GET, but it doesn't work for post method
Route::resource('cart', CartController::class);
I have tried clearing the cache but it didn't solve.
a screenshot from postman:
GET request:
Post request:
I have solved the problem, but I didn't actually know the real reason behind it.
Maybe it is because I remove the valet link and make another one, something related to the caching although I cleared all the cache before.
thank you all for your help
Verb URI Action Route Name
GET /photos index photos.index
GET /photos/create create photos.create
POST /photos store photos.store
GET /photos/{photo} show photos.show
GET /photos/{photo}/edit edit photos.edit
PUT/PATCH /photos/{photo} update photos.update
DELETE /photos/{photo} destroy photos.destroy
make sure your url is in this format

Warning status issue in jmeter result table

I have to do load testing for a web based application. I am getting status as warning the results table. My request contains the URL and the path as /. I have passed username and password in the parameters section. Even after tried many times still it shows status as warning.
I have also tried using Proxyserver address, port, user name and password ...still no luck..
Please help me on this.
If you get a Warning status, this means that JMeter detected a response code > 399.
There can be a lot of reasons for this, examples:
Wrong URL : 404
Error : 500
To have more details on it, add a View Results Tree and inspect all tabs to see:
Request : What you are sending (headers / Cookies / body)
Response : What you are getting (headers / Cookies / body)
Then fix your HTTP request by comparing request in browser with what you have build.
Alternatively, use JMeter recording feature.
To see all ways to debug a script, have a look at this book where sample chapter explains lot of ways.
If you get warning status that means your entered URL contains https:// part which means your given URL working with HTTP protocol.
Remove https:// part from
- HTTP Request Defaults
- HTTP Request
So replace https:// part by WWW and try again

NeoLoad Login 500 Error: Adf_Faces-30200

I'm trying to test java web application (jsf) that uses oracle adf-faces. When I record my test, the application is working fine but when I later check the user, then on login.jsf page, just before authentication and home pages, I get 500 Internal server error that says:
ADF_FACES-30200:For more information, please see the server's error log for an entry beginning with: The UIViewRoot is null. Fatal exception during PhaseId: RESTORE_VIEW 1.
Some more info: My login.jsf page is referred by previous login page that has jsession id appended to it. However, as far as I understand, neoload automatically handles jsessionid (I did try to set a parameter for it though and it didn't fix the error)
Also login.jsf page itself is a referrer to authentication page that in its turn is a referrer to a home page of an application, and the latter are both redirect pages (do not use manual definition) so they are not played during the check because of this error:
login.jsf page uses POST method and it has the following POST parameters: pt1:username, pt1:password, org.apache.myfaces.trinidad.faces.FORM, Adf-Window-Id, javax.faces.ViewState, Adf-Page-Id, oracle.adf.view.rich.DELTAS, event, event.pt1:loginCommandButton
I use set of users (I have a variable for username and password) and I handle javax.faces.ViewState manually with a jsf parameter (it used to give me errors).
I would appreciate any help greatly!

CodeIgniter returns 404 for all routes but works

I have strange problem with CodeIgniter and routing system and can't find solution for it, so: I have several routes such as
'forum/(:num)'
=> 'forum/category/$1',
'forum/(:num)/(page:any)'
=> 'forum/category/$1/$2',
and them works, but return 404 code in header.
I mean I don't get 404 page, correct HTML returns and page's content displays correctly for my forum's categories. But I'm getting 404 in header (Network tab in Firebug), so I can't work with POST data correctly.
If I request /forum/ - 200 Ok returns, but when I trying to get routed page, I get right page, but with 404 Not Found.
I'm using PHP5.4+Apache2 on Linux host, if it will help You to give me solution.
I've found solution! Maybe it will save someone's time.
Problem wasn't in CodeIgniter, I've found solution in activation mod_rewrite. Yes, that worked, but wan't activated in Apache.
Just try to do
sudo a2enmod rewrite
and restart apache service after
sudo service apache restart
And all routed pages will return 200 Ok
None of these worked, but I did this instead:
At the end of my controller I put this:
$this->output->set_status_header('200');
and actually though that worked, the problem turned out to be a controller name that conflicted with a real directory name...

Resources